diff --git a/.github/workflows/test-app.yml b/.github/workflows/test-app.yml index aa2b93a6..1e3743f9 100644 --- a/.github/workflows/test-app.yml +++ b/.github/workflows/test-app.yml @@ -2,23 +2,24 @@ name: Test App on: push: - branches: ["*", "!release/*", "!nightly"] paths: ["cmd/**", "internal/**", "server/**", "test/**", "main.go", "go.mod", "go.sum"] + branches-ignore: ["release/*", "nightly"] tags-ignore: ["v*"] pull_request: - branches: ["*", "!release/*", "!nightly"] paths: ["cmd/**", "internal/**", "server/**", "test/**", "main.go", "go.mod", "go.sum"] + branches-ignore: ["release/*", "nightly"] env: REPORT_DIR: "/tmp/test-reports" jobs: test_app: - name: Test App on ${{ matrix.os }} + name: Test Go on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v4 @@ -27,9 +28,23 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod + cache: false # https://github.com/actions/setup-go/issues/483 - - name: Print the Go version - run: go version + - id: go-vars + name: Get Go variables for cache + run: | + echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" + echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" + + - name: Cache go modules + uses: actions/cache@v4 + with: + path: | + ${{ steps.go-vars.outputs.GOCACHE }} + ${{ steps.go-vars.outputs.GOMODCACHE }} + key: go-test-${{ runner.os }}-${{ hashFiles('**/go.mod') }} + restore-keys: | + go-test-${{ runner.os }} - name: Install tools run: go install gotest.tools/gotestsum@latest @@ -40,18 +55,16 @@ jobs: - name: Run tests run: | mkdir -p $REPORT_DIR - gotestsum \ - --junitfile $REPORT_DIR/unit-tests.xml \ - --jsonfile $REPORT_DIR/unit-tests.json \ - -- -coverprofile=$REPORT_DIR/coverage.out ./... + gotestsum --junitfile $REPORT_DIR/unit-tests.xml --jsonfile $REPORT_DIR/unit-tests.json -- -coverprofile=$REPORT_DIR/coverage.out ./... - name: Upload test results uses: actions/upload-artifact@v4 with: - name: Go-Test-Results + name: Go-Test-Results-${{ runner.os }} path: ${{ env.REPORT_DIR }} - - name: Upload coverage to Codecov + - if: matrix.os == 'ubuntu-latest' + name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: flags: go diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 8c0c631e..2ed04b77 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -2,12 +2,12 @@ name: Test Docs on: push: - branches: ["*", "!release/*", "!nightly"] paths: ["docs/**"] + branches-ignore: ["release/*", "nightly"] tags-ignore: ["v*"] pull_request: paths: ["docs/**"] - branches: ["*", "!release/*", "!nightly"] + branches-ignore: ["release/*", "nightly"] jobs: test_docs: diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index 2f8cfb08..dac04932 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -2,16 +2,17 @@ name: Test Frontend on: push: - branches: ["*", "!release/*", "!nightly"] paths: ["ui/**"] + branches-ignore: ["release/*", "nightly"] tags-ignore: ["v*"] pull_request: paths: ["ui/**"] - branches: ["*", "!release/*", "!nightly"] + branches-ignore: ["release/*", "nightly"] jobs: test_ui: strategy: + fail-fast: false matrix: node: [18, 20] os: [ubuntu-latest, windows-latest]