e2e pipeline #5
Workflow file for this run
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: e2e pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment to run the action on. | |
required: true | |
type: choice | |
options: | |
- sepolia | |
- staging | |
action: | |
description: | |
Action to perform on the selected environment. `Deploy` will | |
upgrade/deploy the Kakarot contracts, while `test` will run the end 2 | |
end tests on the currently deployed stack. | |
required: true | |
type: choice | |
options: | |
- deploy | |
- test | |
jobs: | |
stage: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: install foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
# Install UV | |
- uses: astral-sh/setup-uv@v2 | |
with: | |
enable-cache: true | |
cache-dependency-glob: lib/kakarot/uv.lock | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: lib/kakarot/.python-version | |
- name: Install asdf & tools | |
uses: asdf-vm/actions/setup@v3 | |
- name: install scarb | |
run: | | |
asdf plugin add scarb | |
asdf install scarb 2.8.3 | |
asdf install scarb 2.6.5 | |
asdf install scarb 0.7.0 | |
- name: Run staging script | |
env: | |
STARKNET_SEPOLIA_STAGING_PRIVATE_KEY: | |
${{ secrets.STARKNET_SEPOLIA_STAGING_PRIVATE_KEY }} | |
STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS: | |
${{ secrets.STARKNET_SEPOLIA_STAGING_ACCOUNT_ADDRESS }} | |
INFURA_KEY: ${{ secrets.INFURA_KEY }} | |
run: | | |
cd scripts | |
sh e2e_pipeline.sh ${{ github.event.inputs.action }} --${{ github.event.inputs.environment }} | |
- name: Check diff in deployments | |
run: | | |
cd lib/kakarot | |
set +e | |
git diff --no-patch --exit-code -- deployments/ | |
has_diff=$? | |
set -e | |
echo "has_diff=$has_diff" >> $GITHUB_ENV | |
- uses: actions/create-github-app-token@v1 | |
id: github_token | |
with: | |
app-id: ${{ secrets.KAKAROT_BOT_APP_ID }} | |
private-key: ${{ secrets.KAKAROT_BOT_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
- name: Create PR for deployment updates | |
if: ${{ env.has_diff == 1 }} | |
env: | |
GH_TOKEN: ${{ steps.github_token.outputs.token }} | |
run: | | |
set +e | |
cd lib/kakarot | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git checkout -b update-staging-deployment-run-${{ github.run_id }} | |
git add deployments/kakarot-staging/ | |
git commit -m "Update staging deployments from run ${{ github.run_id }}" | |
git push --set-upstream origin update-staging-deployment-run-${{ github.run_id }} --force | |
gh pr create --repo=kkrt-labs/kakarot --base=main --head=update-staging-deployment-run-${{ github.run_id }} \ | |
--title "Update staging deployments from staging run ${{ github.run_id }}" \ | |
--body "This PR updates the staging deployments for staging run ${{ github.run_id }}." |