add git submodule in tokamak/contracts-bedrock #193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Tokamak Contract Bedrock Test' | |
on: | |
push: | |
paths: | |
- 'op-node/**' | |
- 'packages/tokamak/contracts-bedrock/**' | |
jobs: | |
start-runner: | |
name: Start EC2 Runner | |
runs-on: ubuntu-latest | |
outputs: | |
label: ${{ steps.start-ec2-runner.outputs.label }} | |
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Start EC2 runner | |
id: start-ec2-runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: start | |
github-token: ${{ secrets.ACCESS_TOKEN }} | |
ec2-image-id: ami-01bd9dc38789ab007 | |
ec2-instance-type: t4g.2xlarge | |
subnet-id: subnet-4aa53021 | |
security-group-id: sg-03165a21a3ba6e8b3 | |
- name: Runner status | |
id: status | |
run: | | |
echo "Runner label:" ${{ steps.start-ec2-runner.outputs.label }} | |
echo "EC2 instances id:" ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} | |
stop-runner: | |
name: Stop self-hosted EC2 runner | |
needs: [start-runner, contracts-bedrock-tests] | |
runs-on: ubuntu-latest | |
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Stop EC2 runner | |
uses: machulav/ec2-github-runner@v2 | |
with: | |
mode: stop | |
github-token: ${{ secrets.ACCESS_TOKEN }} | |
label: ${{ needs.start-runner.outputs.label }} | |
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} | |
contracts-bedrock-tests: | |
name: "Contract Bedrock test" | |
needs: [start-runner] | |
runs-on: ${{ needs.start-runner.outputs.label }} | |
container: | |
image: onthertech/titan-ci-builder:latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
# Declares the repository safe and not under dubious ownership. | |
- name: Add repository to git safe directories | |
run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
- name: Restore Node Modules | |
uses: actions/[email protected] | |
with: | |
key: pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }} | |
path: node_modules | |
restore-keys: pnpm-packages-v2-{{ checksum "pnpm-lock.yaml" }} | |
- name: Fetch dependencies | |
run: pnpm fetch --frozen-lockfile --prefer-offline | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --offline | |
- name: Print forge version | |
run: forge --version | |
working-directory: packages/tokamak/contracts-bedrock | |
- name: Run pnpm test | |
run: pnpm test | |
working-directory: packages/tokamak/contracts-bedrock |