Skip to content

Commit

Permalink
refactor(CI): use reusable `build-axon' job to reduce time consuming
Browse files Browse the repository at this point in the history
  • Loading branch information
Flouse committed Aug 16, 2023
1 parent eb133c7 commit ab72b5c
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 25 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/openzeppelin_test_11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ on:
required: true

jobs:
# Build Axon and cache the binary
build-axon:
uses: ./.github/workflows/build.yml

openzeppelin-contracts-1:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
runs-on: ubuntu-latest
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
Expand Down Expand Up @@ -90,9 +97,16 @@ jobs:
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}

- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
Expand All @@ -118,6 +132,7 @@ jobs:
with:
name: jfoa-build-reports-${{ runner.os }}
path: openzeppelin-contracts/mochawesome-report/

finally:
name: Finally
needs: [ openzeppelin-contracts-1 ]
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/openzeppelin_test_16_19.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ on:
required: true

jobs:
# Build Axon and cache the binary
build-axon:
uses: ./.github/workflows/build.yml

openzeppelin-contracts-1:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
runs-on: ubuntu-latest
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
Expand Down Expand Up @@ -90,9 +97,16 @@ jobs:
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}

- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
Expand Down Expand Up @@ -133,6 +147,7 @@ jobs:
with:
name: jfoa-build-reports-${{ runner.os }}
path: openzeppelin-contracts/mochawesome-report/

finally:
name: Finally
needs: [ openzeppelin-contracts-1 ]
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/openzeppelin_test_6_10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ on:
required: true

jobs:
# Build Axon and cache the binary
build-axon:
uses: ./.github/workflows/build.yml

openzeppelin-contracts-1:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
runs-on: ubuntu-latest
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
Expand Down Expand Up @@ -90,9 +97,16 @@ jobs:
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}

- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
- name: Run prepare
Expand Down Expand Up @@ -138,6 +152,7 @@ jobs:
with:
name: jfoa-build-reports-${{ runner.os }}
path: openzeppelin-contracts/mochawesome-report/

finally:
name: Finally
needs: [ openzeppelin-contracts-1 ]
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/v3_core_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ on:
required: true

jobs:
# Build Axon and cache the binary
build-axon:
uses: ./.github/workflows/build.yml

v3-core-test:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
runs-on: ubuntu-latest
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
Expand Down Expand Up @@ -79,9 +86,16 @@ jobs:
- id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}

- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
- name: Install dependencies
Expand Down Expand Up @@ -119,6 +133,7 @@ jobs:
with:
name: jfoa-build-reports-${{ runner.os }}
path: v3-core/mochawesome-report/

finally:
name: Finally
needs: [ v3-core-test ]
Expand Down
41 changes: 32 additions & 9 deletions .github/workflows/web3_compatible.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Web3 Compatible Tests

on:
push:
push:
branches:
- main
pull_request:
Expand All @@ -14,13 +14,20 @@ on:
required: true

jobs:
# Build Axon and cache the binary
build-axon:
uses: ./.github/workflows/build.yml

dispatch-web3-compatible:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
if: contains(github.event_name, 'workflow_dispatch')
runs-on: ubuntu-latest
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
Expand Down Expand Up @@ -91,9 +98,15 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}
- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
- name: Run Test
Expand All @@ -111,6 +124,7 @@ jobs:
with:
name: jfoa-build-reports-${{ runner.os }}
path: axon-test/mochawesome-report/

finally:
name: Finally
needs: [ dispatch-web3-compatible ]
Expand Down Expand Up @@ -141,14 +155,17 @@ jobs:
})
web3-compatible:
needs: build-axon
strategy:
fail-fast: false
matrix:
net: ["axon"]
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
if: |
(contains(fromJson('["dependabot[bot]" ]'), github.actor) && github.event_name == 'pull_request') ||
(contains(github.event_name, 'push') && github.ref == 'refs/heads/main' )
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
Expand All @@ -172,9 +189,15 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
path: |
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}
- name: Deploy Local Network of Axon
run: |
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --genesis devtools/chain/genesis_single_node.json > /tmp/log 2>&1 &
- name: Run Test
Expand Down

0 comments on commit ab72b5c

Please sign in to comment.