feat(runtime): update go to 1.21.0 and update action deps #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: branch | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- '**' | |
jobs: | |
branch: | |
name: Test, Build Source, Build Image | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_NAME: go-redirector | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.21.0' | |
- name: Setup Vars | |
run: | | |
echo "BuildVersion=$(cat .version)" >> $GITHUB_ENV | |
echo "BuildSha=$(echo $GITHUB_SHA | cut -c1-8)" >> $GITHUB_ENV | |
echo "BuildDate=$(date '+%Y.%m.%d-%T')" >> $GITHUB_ENV | |
- name: Calc coverage | |
run: | | |
go test --race -covermode=atomic -coverprofile=coverage.out ./... | |
- name: Convert coverage.out to coverage.lcov | |
uses: jandelgado/[email protected] | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage.lcov | |
- name: Compile | |
run: | | |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \ | |
-ldflags="-s -w" \ | |
-ldflags "-X main.BuildSha=BuildSha \ | |
-X main.BuildVersion=BuildVersion \ | |
-X main.BuildDate=BuildDate" \ | |
-o dist/linux/$IMAGE_NAME-linux-amd64 main.go | |
- name: Show binary version info | |
run: dist/linux/$IMAGE_NAME-linux-amd64 -version | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./ci/Dockerfile | |
context: . | |
push: false | |
tags: user/app:latest | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.0 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Calc coverage | |
run: | | |
go test --race -covermode=atomic -coverprofile=coverage.out ./... | |
- name: Convert coverage.out to coverage.lcov | |
uses: jandelgado/gcov2lcov-action@v1 | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.github_token }} | |
path-to-lcov: coverage.lcov |