Skip to content

Commit

Permalink
Ci self hosted runner (privacy-scaling-explorations#638)
Browse files Browse the repository at this point in the history
* Change tag for self hosted runner

* Create script that wakes up the new runner

* Modify workflow to run specific job)s) on a self-hosted runner

* Remove concurrency + add consecutiveness linked with self-hosted job(s)
  • Loading branch information
ntampakas authored Jul 27, 2022
1 parent 18dfe7c commit d1d07bb
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/ciChecksScripts/wakeUpRunner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

profile="cirunner"
runner_vpc_id="vpc-08ac0db4d8a7cce9e"

# Get runner status
runner=$(aws ec2 describe-instances --profile $profile --filters Name=tag:Name,Values=[ci-checks-runner] Name=network-interface.vpc-id,Values=[$runner_vpc_id] --query "Reservations[*].Instances[*][InstanceId]" --output text | xargs)
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner --query "Reservations[*].Instances[*].State.[Name]" --output text)

while true; do
if [ $runner_status = "stopped" ]; then
aws ec2 start-instances --profile $profile --instance-ids $runner
exit 0
elif [ $runner_status = "running" ]; then
sleep 120
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner --query "Reservations[*].Instances[*].State.[Name]" --output text)
if [ $runner_status = "running" ]; then
exit 0
fi
else
sleep 30
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/ProverBenchFromHalo2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
type: string
jobs:
Exec-ProverBench-on-halo2-PR:
runs-on: self-hosted
runs-on: pse-runner
env:
GH_USER: ${{ github.event.inputs.ghuser }}
HALO2PR: ${{ github.event.inputs.halo2pr }}
Expand Down
82 changes: 80 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,84 @@ on:
## `rust-toolchain` is always used and the only source of truth.

jobs:

consecutiveness:
if: github.event.pull_request.draft == false && github.repository == 'privacy-scaling-explorations/zkevm-circuits'

runs-on: ubuntu-latest
steps:
- uses: mktcode/consecutive-workflow-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

wakeuprunner:
if: github.event.pull_request.draft == false && github.repository == 'privacy-scaling-explorations/zkevm-circuits'

needs: [consecutiveness]
name: Wake up self-hosted runner
runs-on: pse-runner

steps:
- uses: actions/checkout@v2
- run: |
.github/ciChecksScripts/wakeUpRunner.sh
test:
if: github.event.pull_request.draft == false
if: github.event.pull_request.draft == false && github.repository == 'privacy-scaling-explorations/zkevm-circuits'

needs: [wakeuprunner]
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
# We don't need to test across multiple platforms yet
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ci-checks-runner]

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
override: false
- name: Setup golang
uses: actions/setup-go@v3
with:
go-version: ~1.18
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run light tests # light tests are run in parallel
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks
- name: Run heavy tests # heavy tests are run serially to avoid OOM
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored --test-threads 1

test_forks:
if: github.event.pull_request.draft == false && github.repository != 'privacy-scaling-explorations/zkevm-circuits'

name: Test on ${{ matrix.os }}
name: Test_forks
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -27,6 +101,10 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
override: false
- name: Setup golang
uses: actions/setup-go@v3
with:
go-version: ~1.18
# Go cache for building geth-utils
- name: Go cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-actions-prover-benches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
Prover_benchmarking_Automation:
if: contains(github.event.label.name, 'benchmarks')
runs-on: self-hosted
runs-on: pse-runner
env:
PR_NUMBER: ${{ github.event.number }}

Expand Down

0 comments on commit d1d07bb

Please sign in to comment.