-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: merge upstream changes (#1550)
- Loading branch information
Showing
39 changed files
with
561 additions
and
302 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: "Toolchain installation test with EC2" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image-id: | ||
required: true | ||
type: "string" | ||
instance-type: | ||
required: true | ||
type: "string" | ||
root-volume: | ||
required: false | ||
type: "string" | ||
default: "/dev/sda1" | ||
secrets: | ||
AWS_REGION: | ||
required: true | ||
AWS_ACCESS_KEY_ID: | ||
required: true | ||
AWS_SECRET_ACCESS_KEY: | ||
required: true | ||
AWS_SUBNET_ID: | ||
required: true | ||
AWS_SG_ID: | ||
required: true | ||
GH_PAT: | ||
required: true | ||
|
||
jobs: | ||
start-runner: | ||
name: "Start self-hosted 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: | ||
# Use an access key for an IAM user with these permissions: | ||
# - ec2:RunInstances | ||
# - ec2:TerminateInstances | ||
# - ec2:DescribeInstances | ||
# - ec2:DescribeInstanceStatus | ||
- name: "Configure AWS credentials" | ||
uses: "aws-actions/configure-aws-credentials@v1" | ||
with: | ||
aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}" | ||
aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | ||
aws-region: "${{ secrets.AWS_REGION }}" | ||
|
||
- name: "Start EC2 runner" | ||
id: "start-ec2-runner" | ||
uses: "xJonathanLEI/ec2-github-runner@main" | ||
with: | ||
mode: "start" | ||
# Must use personal access token here as `GITHUB_TOKEN` does not have access to runners. | ||
# Use a fine-grained token with these permissions to at least this repository: | ||
# - Administration: Read and write | ||
# - Contents: Read and write | ||
# - Metadata: Read-only | ||
# - Workflows: Read and write | ||
github-token: "${{ secrets.GH_PAT }}" | ||
ec2-image-id: "${{ inputs.image-id }}" | ||
ec2-instance-type: "${{ inputs.instance-type }}" | ||
subnet-id: "${{ secrets.AWS_SUBNET_ID }}" | ||
security-group-id: "${{ secrets.AWS_SG_ID }}" | ||
storage-size: 1024 | ||
storage-device: "${{ inputs.root-volume }}" | ||
|
||
toolchain-test: | ||
name: "Run toolchain test" | ||
runs-on: "${{ needs.start-runner.outputs.label }}" | ||
needs: | ||
- "start-runner" | ||
|
||
steps: | ||
# Workaround for EC2 runner missing $HOME | ||
- name: "Set HOME env var" | ||
run: | | ||
if [ -z "$HOME" ]; then | ||
echo "HOME=/home/ubuntu" >> $GITHUB_ENV | ||
fi | ||
- name: "Checkout" | ||
uses: "actions/checkout@v4" | ||
|
||
- name: "Install Rust" | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
- name: "Install build dependencies" | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential pkg-config libssl-dev | ||
- name: "Install cargo-prove" | ||
run: | | ||
cargo install --locked --path ./crates/cli | ||
- name: "Install SP1 toolchain" | ||
run: | | ||
cargo prove install-toolchain --token ${{ secrets.GH_PAT }} | ||
stop-runner: | ||
name: "Stop self-hosted EC2 runner" | ||
runs-on: "ubuntu-latest" | ||
needs: | ||
- "start-runner" | ||
- "toolchain-test" | ||
if: ${{ always() }} | ||
|
||
steps: | ||
- name: "Configure AWS credentials" | ||
uses: "aws-actions/configure-aws-credentials@v1" | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: "Stop EC2 runner" | ||
uses: "xJonathanLEI/ec2-github-runner@main" | ||
with: | ||
mode: "stop" | ||
github-token: ${{ secrets.GH_PAT }} | ||
label: "${{ needs.start-runner.outputs.label }}" | ||
ec2-instance-id: "${{ needs.start-runner.outputs.ec2-instance-id }}" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.