always test with latest stable #414
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 | |
on: | |
pull_request: {} | |
push: {} | |
permissions: write-all | |
jobs: | |
# ================ | |
# BUILD AND TEST JOB | |
# ================ | |
test: | |
name: Build & Test | |
strategy: | |
matrix: | |
# optionally test/build across multiple platforms/Go-versions | |
go-version: ["stable"] # '1.16', '1.17', '1.18, | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
check-latest: true | |
- name: Build | |
run: go build -v -o /dev/null . | |
- name: Test | |
run: go test -v ./... | |
# ================ | |
# RELEASE BINARIES (on push "v*" tag) | |
# ================ | |
release_binaries: | |
name: Release Binaries | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: goreleaser | |
if: success() | |
uses: docker://goreleaser/goreleaser:latest | |
env: | |
GITHUB_USER: ${{ github.repository_owner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: release --config .github/goreleaser.yml | |
# ================ | |
# RELEASE DOCKER IMAGES (on push "v*" tag) | |
# ================ | |
release_docker: | |
name: Release Docker Images | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: jpillora | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: jpillora/chisel | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: .github/Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |