Skip to content

Implementing an automatic release workflow #70

Implementing an automatic release workflow

Implementing an automatic release workflow #70

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "**" ]
env:
golang-version: 1.20.2
golangci-lint-version: v1.51.2
docker-registry: ghcr.io
docker-image-name: ${{ github.repository }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.golang-version }}
id: go
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.golangci-lint-version }}
- name: Format
run: |
make fmt
git diff --exit-code .
- name: Build
run: make build
test:
name: unit
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install colima on MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install colima docker && colima start
- name: Set up Go
uses: actions/setup-go@v3.5.0
with:
go-version: ${{ env.golang-version }}
id: go
- name: Use Go module caching
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
if: ${{ matrix.os != 'macos-latest' }}
run: make test > unit-run.log 2>&1
- name: Test
if: ${{ matrix.os == 'macos-latest' }}
run: make test > unit-run.log 2>&1
env:
DOCKER_HOST: 'unix:///Users/runner/.colima/default/docker.sock'
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: '/var/run/docker.sock'
- name: 'Print failure logs'
if: ${{ failure() }}
run: cat unit-run.log
- name: 'Upload Log Artifact'
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: unit-run.log
path: unit-run.log
retention-days: 5