Skip to content

Commit

Permalink
Use self-hosted runner
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Dec 16, 2024
1 parent 089b986 commit 605f5c5
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 6 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/build-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,30 @@ name: Build and Format
on: [push]

jobs:
build-and-format:
start-spot-vm:
name: Start Spot VM
runs-on: ubuntu-latest
steps:
- name: Authenticate with GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'

- name: Start Spot VM
run: gcloud compute instances start email-tx-builder-runner-spot --zone=us-central1-c

- name: Wait for Spot VM to initialize
run: |
echo "Waiting for Spot VM to initialize..."
sleep 60
build-and-format:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -62,3 +83,22 @@ jobs:

- name: Run clippy
run: cargo clippy -- -D warnings

stop-spot-vm:
name: Stop Spot VM
needs: [build-and-format]
runs-on: ubuntu-latest
steps:
- name: Authenticate with GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'

- name: Stop Spot VM
run: gcloud compute instances stop email-tx-builder-runner-spot --zone=us-central1-c

57 changes: 52 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,32 @@ name: Unit Tests
on: [push]

jobs:
start-spot-vm:
name: Start Spot VM
runs-on: ubuntu-latest

steps:
- name: Authenticate with GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'

- name: Start Spot VM
run: gcloud compute instances start email-tx-builder-runner-spot --zone=us-central1-c

- name: Wait for Spot VM to initialize
run: |
echo "Waiting for Spot VM to initialize..."
sleep 60
circuits:
name: circuits
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

Expand All @@ -21,8 +44,14 @@ jobs:
override: true
components: rustfmt, clippy

- name: Create bin directory
run: mkdir -p $HOME/bin

- name: Download circom v2.1.9 (Linux)
run: wget https://github.com/iden3/circom/releases/download/v2.1.9/circom-linux-amd64 -O /usr/local/bin/circom && chmod +x /usr/local/bin/circom
run: |
wget https://github.com/iden3/circom/releases/download/v2.1.9/circom-linux-amd64 -O $HOME/bin/circom
chmod +x $HOME/bin/circom
echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
- name: Print circom version
run: circom --version
Expand All @@ -40,11 +69,11 @@ jobs:

- name: Run tests
working-directory: packages/circuits
run: yarn test --runInBand --no-cache
run: yarn test --maxWorkers=75% --no-cache

contracts:
name: contracts
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -74,7 +103,7 @@ jobs:

relayer:
name: relayer
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v3

Expand All @@ -101,3 +130,21 @@ jobs:
- name: Run tests
working-directory: packages/relayer
run: cargo test

stop-spot-vm:
name: Stop Spot VM
needs: [circuits, contracts, relayer]
runs-on: ubuntu-latest
steps:
- name: Authenticate with GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'

- name: Stop Spot VM
run: gcloud compute instances stop email-tx-builder-runner-spot --zone=us-central1-c

0 comments on commit 605f5c5

Please sign in to comment.