Skip to content

Dev

Dev #214

Workflow file for this run

name: test
on: pull_request
jobs:
tag:
name: Calculate next version tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Calculate tag
uses: mathieudutour/github-tag-action@v6.2
id: tag
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
custom_release_rules: chore:patch:Chores
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: WillAbides/setup-go-faster@v1.14.0
with:
go-version: '1.22.0'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
analyze:
name: Analyze code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
containers:
name: Create containers
runs-on: ubuntu-latest
needs:
- lint
- analyze
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: WillAbides/setup-go-faster@v1.14.0
with:
go-version: '1.22.0'
- name: Setup Ko
uses: imjasonh/setup-ko@v0.7
with:
version: v0.11.2
- name: Build containers
run: |
ko build \
--base-import-paths \
--platform=linux/amd64,linux/arm/v7,linux/arm64 \
--push=false \
--image-label="org.opencontainers.image.title=${{ github.event.repository.name }}" \
--image-label="org.opencontainers.image.description=${{ github.event.repository.description }}" \
--image-label="org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
--image-label="org.opencontainers.image.revision=${{ github.sha }}" \
./
binaries:
name: Create binaries
runs-on: ubuntu-latest
needs:
- lint
- analyze
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm, arm64]
exclude:
- goos: windows
goarch: "386"
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch short SHA
uses: benjlevesque/short-sha@v3.0
id: short-sha
- name: Setup Go
uses: WillAbides/setup-go-faster@v1.14.0
with:
go-version: '1.22.0'
- name: Build binaries
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
BINARY: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.goos }}-${{ matrix.goarch }}
VERSIONFLAG: -X 'main.Version=${{ steps.short-sha.outputs.sha }}'
run: |
go build -ldflags="${VERSIONFLAG}" -o ${BINARY}
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: ${{ github.event.repository.name }}-*-*-*
retention-days: 1
artifacts:
name: Test artifacts
runs-on: ubuntu-latest
needs:
- binaries
steps:
- name: Fetch binaries
uses: actions/download-artifact@v4
with:
pattern: ${{ github.event.repository.name }}-*-*-*
merge-multiple: true
- run: ls -lR ${{ github.event.repository.name }}-*-*-*