Skip to content

Bump Go 1.21

Bump Go 1.21 #508

Workflow file for this run

name: Wait4X CI
on:
push:
branches:
- 'main'
- 'release/*'
tags:
- 'v*'
pull_request:
branches:
- '*'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache-dependency-path: go.sum
- name: Checkout Code
uses: actions/checkout@v3
- name: go-fmt
run: make check-gofmt
- name: go-vet
run: go vet ./...
- name: revive
run: |
go install github.com/mgechev/[email protected]
make check-revive
test:
name: Test
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: 1.21.x
cache-dependency-path: go.sum
- name: Test Wait4X
run: make test
- name: Convert coverage to lcov
uses: jandelgado/[email protected]
with:
infile: coverage.out
outfile: coverage.lcov
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
atkrad/wait4x
### versioning strategy
### push semver tag v3.2.1 on the default branch
# atkrad/wait4x:2.2.0
# atkrad/wait4x:2.2
# atkrad/wait4x:2
# atkrad/wait4x:latest
### push semver pre-release tag v3.0.0-beta.1 on the default branch
# atkrad/wait4x:3.0.0-beta.1
### push on the default branch
# atkrad/wait4x:edge
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=pr
type=edge,branch=${{ github.event.repository.default_branch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 5
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build artifacts
uses: docker/bake-action@v2
with:
targets: artifact
- name: Move artifacts
run: |
mv ./dist/**/* ./dist/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wait4x-artifacts
path: ./dist/*
if-no-files-found: error
- name: Build images
uses: docker/bake-action@v2
with:
push: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }}
targets: image
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
if: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
short-description: ${{ github.event.repository.description }}
- name: GitHub Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: true
generate_release_notes: true
files: |
dist/*.tar.gz
dist/*.sha256sum
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}