-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93c1ad9
commit 64206da
Showing
2 changed files
with
87 additions
and
90 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,88 @@ | ||
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 | ||
# | ||
#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 | ||
# |