Skip to content

Merge pull request #398 from ffranr/no-auth-cli-flag #1016

Merge pull request #398 from ffranr/no-auth-cli-flag

Merge pull request #398 from ffranr/no-auth-cli-flag #1016

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "*"
merge_group:
branches:
- "main"
defaults:
run:
shell: bash
env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOMODCACHE: /home/runner/work/go/pkg/mod
GOPATH: /home/runner/work/go
GO111MODULE: on
# If you change this value, please change it in the following files as well:
# /Dockerfile
# /dev.Dockerfile
# /make/builder.Dockerfile
# /taprpc/Dockerfile
# /tools/Dockerfile
GO_VERSION: '1.20.5'
jobs:
#######################
# sql model generation
#######################
sqlc-check:
name: Sqlc check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: docker image cache
uses: satackey/[email protected]
- name: Generate sql models
run: make sqlc-check
rpc-check:
name: RPC check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Generate RPC stubs and check REST annotations
run: make rpc-check
mod-check:
name: go mod check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Run go mod tidy
run: make mod-check
########################
# Compilation check.
########################
compile-check:
name: Compilation check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: compile code
run: go install -v ./...
########################
# cross compilation
########################
cross-compile:
name: cross compilation
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
- name: build release for all architectures
run: make release
########################
# Lint check.
########################
lint-check:
name: Lint check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: run lint
run: make lint
########################
# Format check.
########################
format-check:
name: Format check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: run format
run: make fmt
########################
# run unit tests
########################
unit-test:
name: run unit tests
runs-on: ubuntu-latest
strategy:
# Allow other tests in the matrix to continue if one fails.
fail-fast: false
matrix:
unit_type:
- unit-race
- unit-cover
- unit dbbackend=postgres
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: run ${{ matrix.unit_type }}
run: make ${{ matrix.unit_type }}
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
if: matrix.unit_type == 'unit-cover'
with:
path-to-profile: coverage.txt
parallel: true
########################
# run integration tests
########################
integration-test:
name: run itests
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: run itest
run: make itest
- name: Zip log files on failure
if: ${{ failure() }}
run: 7z a logs-itest.zip itest/**/*.log
- name: Upload log files on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: logs-itest
path: logs-itest.zip
retention-days: 5
########################
# run integration tests with Postgres backend
########################
integration-test-postgres:
name: run itests postgres
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Setup go environment
uses: ./.github/actions/setup-go
- name: run itest
run: make itest dbbackend=postgres
- name: Zip log files on failure
if: ${{ failure() }}
run: 7z a logs-itest-postgres.zip itest/**/*.log
- name: Upload log files on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: logs-itest-postgres
path: logs-itest-postgres.zip
retention-days: 5