Skip to content

Commit

Permalink
try again?
Browse files Browse the repository at this point in the history
  • Loading branch information
sesheffield committed Jul 25, 2024
1 parent 93c1ad9 commit 64206da
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 90 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
**.go

- name: List all changed files
env:
Expand Down
174 changes: 87 additions & 87 deletions .github/workflows/go.yml
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
#

0 comments on commit 64206da

Please sign in to comment.