Skip to content

WIP

WIP #8

Workflow file for this run

name: Golang CI
on:
merge_group:
pull_request:
branches:
- '*'
env:
GO_VERSION: '1.21'
jobs:
changed_files:
name: Changed Files
runs-on: ubutnu-latest
outputs:
changed_files: ${{ steps.changed_files.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Changed Files
id: changed_files
uses: ./.github/actions/changed_files
golang-ci:
needs:
- changed_files
if: |
contains(needs.changed_files.outputs.changed_files, '.go')
name: golangci-lint
runs-on:
labels: 16-cores
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup_go
with:
cache: false
- name: Load Version
id: load-version
run: |
echo "GOLANGCI_VERSION=v$(cat .golangci-version)"
- name: golangci-ling
uses: golangci/golangci-lint-action@v6
with:
version: $${{ steps.load-version.outputs.GOLANGCI_VERSION }}
args: --timeout 30m --verbose --allow-parallel-runners --max-same-issues 0 --max-issues-per-linter 0
working-directory: ${{ github.workspace }}
golang-test:
needs:
- changed_files
if: |
contains(needs.changed_files.outputs.changed_files, '.go') ||
contains(needs.changed_files.outputs.changed_files, 'go.sum') ||
(
contains(needs.changed_files.outputs.changed_files, '.yml') ||
contains(needs.changed_files.outputs.changed_files, '.yaml')
)
&&
(
contains(needs.changed_files.outputs.changed_files, 'app') ||
contains(needs.changed_files.outputs.changed_files, 'client') ||
contains(needs.changed_files.outputs.changed_files, 'cmd') ||
contains(needs.changed_files.outputs.changed_files, 'migrate') ||
contains(needs.changed_files.outputs.changed_files, 'tests') ||
contains(needs.changed_files.outputs.changed_files, 'x')
)
name: go test
runs-on:
labels: 16-cores
env:
COVERAGE_DIR: out/coverage/unit/go
COVERAGE_PATH: out/coverage/unit/go/cover.out
FORMATTED_REPORT: out/coverage/unit/go/go-unit-cover.out
HTML_REPORT: out/coverage/unit/go/go-unit-cover.html
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup_go
- name: Go Test
run: |
mkdir -p ${{ env.COVERAGE_DIR }}
readarray -t test_dirs < <(find * -name "*_test.go" -exec dirname {} \; | sort | uniq | grep -v -e '^\.$')
half_nproc=$(( $(nproc --all) / 2 ))
printf '%s\0' "${test_dirs[@]}" | xargs -0 -P $half_nproc -n 1 -I {} go test "./{}" -race