Skip to content

Commit

Permalink
Remove self-hosted runner as soon as we're done with it
Browse files Browse the repository at this point in the history
instead of removing everything at the end after waiting for all jobs in
the matrix to complete.
  • Loading branch information
atodorov committed Jul 30, 2024
1 parent 4cc26d7 commit 89cd8b4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/provision-github-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ curl -L https://github.com/actions/runner/releases/download/v2.317.0/actions-run
tar xzf ./runner.tar.gz
sudo ./bin/installdependencies.sh
# for 3rd party dependencies and building the code
sudo apt install -y build-essential clang curl gcc jq libssl-dev pkg-config protobuf-compiler unzip
sudo apt install -y build-essential clang curl gcc jq libssl-dev pipx pkg-config protobuf-compiler unzip

OWNER_REPO_SLUG="gluwa/creditcoin3"
REPOSITORY_URL="https://github.com/$OWNER_REPO_SLUG"
Expand Down
1 change: 1 addition & 0 deletions .github/remove-linode-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -x
# Install linode-cli
python3 --version
pipx install linode-cli
export PATH="$PATH:~/.local/bin"
linode-cli --version

VM_ID=$(linode-cli linodes list --json --label "$LC_RUNNER_VM_NAME" | jq -r '.[0].id')
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ jobs:
command: clippy
args: --all-targets --all-features -- -D warnings -A clippy::too_many_arguments -A clippy::type_complexity

# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

check:
runs-on: [self-hosted, "workflow-${{ github.run_id }}", "proxy-check"]

Expand Down Expand Up @@ -290,6 +299,15 @@ jobs:
run: |
SKIP_WASM_BUILD=1 cargo check --features=runtime-benchmarks --release
# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

unit-test-creditcoin:
runs-on:
[
Expand Down Expand Up @@ -325,6 +343,15 @@ jobs:
command: test
args: --features=runtime-benchmarks -- --test-threads 1

# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

build-creditcoin-node:
strategy:
fail-fast: false
Expand Down Expand Up @@ -390,6 +417,15 @@ jobs:
name: creditcoin_node_runtime.compact.compressed.wasm-${{ matrix.target }}
path: target/release/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm

# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

build-creditcoin-node-for-testing:
needs:
- build-creditcoin-node
Expand Down Expand Up @@ -457,6 +493,15 @@ jobs:
name: creditcoin_node_runtime.compact.compressed.wasm-for-${{ matrix.target }}
path: target/release/wbuild/creditcoin3-runtime/creditcoin_next_runtime.compact.compressed.wasm

# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

integration-test-smart-contract:
needs:
- build-creditcoin-node-for-testing
Expand Down Expand Up @@ -699,6 +744,7 @@ jobs:
echo "runner_vm_name=${{ env.RUNNER_VM_NAME }}-$HASH_VALUE" >> "$GITHUB_OUTPUT"
- name: Remove VM
continue-on-error: true
run: |
.github/remove-linode-vm.sh
env:
Expand Down Expand Up @@ -875,6 +921,15 @@ jobs:
fail_ci_if_error: false
verbose: true

# keep this always as the last step
- name: Remove self-hosted
if: always()
run: |
.github/remove-linode-vm.sh
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
LC_RUNNER_VM_NAME: ${{ runner.name }}

integration-test-blockchain:
needs:
- build-creditcoin-node-for-testing
Expand Down

0 comments on commit 89cd8b4

Please sign in to comment.