Skip to content

Commit

Permalink
ci: split test and validate workflow (#413)
Browse files Browse the repository at this point in the history
* ci: split test and validate workflow

* ci: concurrency check

---------

Co-authored-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max and crazy-max authored May 7, 2023
1 parent cffc4af commit 7e0ddfe
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
schedule:
- cron: '0 10 * * *' # everyday at 10am
- cron: '0 10 * * *'
workflow_dispatch:
push:
branches:
Expand All @@ -11,9 +15,6 @@ on:
tags:
- 'v*'
pull_request:
branches:
- 'master'
- 'releases/v*'

jobs:
ci:
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
Expand All @@ -16,11 +20,6 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Validate
uses: docker/bake-action@v3
with:
targets: validate
-
name: Test
uses: docker/bake-action@v3
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: validate

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- 'master'
- 'releases/v*'
pull_request:

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Targets matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
validate:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Validate
uses: docker/bake-action@v3
with:
targets: ${{ matrix.target }}

0 comments on commit 7e0ddfe

Please sign in to comment.