Skip to content

test: add condition #135

test: add condition

test: add condition #135

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-bazel:
name: Test (Bazel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- uses: actions/cache@v4
with:
path: "~/.cache/bazel"
key: bazel
- run: bazelisk test //... --test_output=errors
test-go:
name: Test (Go)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: foo/go.mod
cache-dependency-path: foo/go.sum
cache: true
- run: |
go test -v foo/...
test-prepare:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.run.outputs.run }}
steps:
- run: echo "run=true" >> $GITHUB_OUTPUT
id: run
test-1:
runs-on: ubuntu-latest
needs: test-prepare
if: ${{ needs.test-prepare.outputs.run == 'true' }}
steps:
- run: exit 1
test-2:
runs-on: ubuntu-latest
needs: test-prepare
if: ${{ needs.test-prepare.outputs.run == 'false' }}
steps:
- run: echo 2
test-final:
runs-on: ubuntu-latest
needs: [test-prepare, test-1, test-2]
if: ${{ always() && ((needs.test-1.result == 'success' && needs.test-2.result == 'skipped') || (needs.test-2.result == 'success' && needs.test-1.result == 'skipped')) }}
steps:
- run: echo final