Skip to content

Commit

Permalink
Combine all CI into a single file and generate the matrix dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsporn committed Oct 18, 2023
1 parent 41ac4c7 commit 5b30421
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 42 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

on: [pull_request]

jobs:
prep-test:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set matrix
id: set-matrix
run: |
echo "::set-output name=matrix::[$(find . -name 'go.mod' -exec dirname {} \; | sort -u | sed 's|^\./||' | sed 's/.*/"&"/' | tr '\n' ',' | sed 's/,$//')]"
go-test:
needs: prep-test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.prep-test.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run tests core
working-directory: ./${{ matrix.module }}
run: go test ./... -tags rocksdb,stacktrace -count=1 -timeout 10m

golangci-lint:
needs: prep-test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{fromJson(needs.prep-test.outputs.matrix)}}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
workdir: ./${{ matrix.module }}
github_token: ${{ secrets.GITHUB_TOKEN }}
golangci_lint_flags: "--timeout=10m"
reviewdog_flags: "-name=golangci-${{ matrix.module }}"
reporter: github-pr-check
filter_mode: nofilter
fail_on_error: true
21 changes: 0 additions & 21 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,4 @@ name: CI
on: [pull_request]

jobs:
golangci-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: [ ads, crypto, serializer, core, logger, app, constraints, ds, web, stringify, runtime, codegen, kvstore, ierrors, apputils, log, lo ]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
workdir: ./${{ matrix.module }}
github_token: ${{ secrets.GITHUB_TOKEN }}
golangci_lint_flags: "--timeout=10m"
reviewdog_flags: "-name=golangci-${{ matrix.module }}"
reporter: github-pr-check
filter_mode: nofilter
fail_on_error: true
21 changes: 0 additions & 21 deletions .github/workflows/test.yml

This file was deleted.

0 comments on commit 5b30421

Please sign in to comment.