CI: Travis -> GitHub Actions; Create Release Binaries and Container Images #3
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: CI | |
# Workflow is triggered on: | |
# - every pull request to every branch | |
# - every push to every branch | |
# - every workflow_dispatch event | |
on: | |
- pull_request | |
- push | |
- workflow_dispatch | |
# Workflow permissions: | |
# - write access to checks to allow actions to annotate code in the PR. | |
# - read access to the content for analysis. | |
# - write access to packages to allow the workflow to publish to the GitHub Container Registry. | |
# - read access to pull requests for `goveralls`. | |
permissions: | |
checks: write | |
contents: read | |
packages: write | |
pull-requests: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-arch: | |
- amd64 | |
- arm64 | |
go-os: | |
- darwin | |
- linux | |
- windows | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version-file: go.mod | |
- name: Build Go | |
env: | |
GOARCH: ${{ matrix.go-arch }} | |
GOOS: ${{ matrix.go-os }} | |
run: ./build.sh | |
- name: Store artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.go-os }}-${{ matrix.go-arch }} | |
path: dist | |
docker: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: | |
- pebble | |
- pebble-challtestsrv | |
docker-arch: | |
- amd64 | |
- arm64 | |
docker-os: | |
- linux | |
- windows | |
exclude: | |
- docker-arch: arm64 | |
docker-os: windows | |
steps: | |
- name: Download all build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: dist | |
pattern: dist-* | |
- name: Display artifacts | |
run: ls -lR dist | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: APP=${{ matrix.app }} | |
build-contexts: dist-files=dist | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: Dockerfile.release | |
platforms: ${{ matrix.docker-os }}/${{ matrix.docker-arch }} | |
push: true | |
tags: ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ github.sha }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Check Go Modules | |
run: ./mods.sh | |
- name: GolangCI-Lint | |
uses: golangci/golangci-lint-action@v4 | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run containerized test suite | |
run: ./t.sh | |
- name: Send code coverage | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: profile.cov |