chore: add BOT_APPROVED_FILES #8503
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
# When getting Rust dependencies, retry on network error: | |
CARGO_NET_RETRY: 10 | |
# Use the local .curlrc | |
CURL_HOME: . | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
sources: ${{ steps.filter.outputs.sources }} | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event_name == 'push' | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
sources: | |
- .github/workflows/e2e.yml | |
- e2e/** | |
- scripts/workflows/e2e-matrix.py | |
- scripts/workflows/provision-darwin.sh | |
- scripts/workflows/provision-linux.sh | |
- scripts/test-uis.py | |
- src/canisters/frontend/** | |
- src/dfx/** | |
- src/dfx-core/** | |
- src/distributed/** | |
- src/lib/** | |
- Cargo.lock | |
- Cargo.toml | |
- rust-toolchain.toml | |
build_dfx: | |
if: needs.changes.outputs.sources == 'true' | |
needs: changes | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# We build a dynamic-linked linux binary because otherwise HSM support fails with: | |
# Error: IO: Dynamic loading not supported | |
os: [macos-13-large, ubuntu-20.04, ubuntu-22.04, windows-2022] | |
include: | |
- os: macos-13-large | |
target: x86_64-apple-darwin | |
binary_path: target/x86_64-apple-darwin/release/dfx | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
binary_path: target/x86_64-unknown-linux-gnu/release/dfx | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
binary_path: target/x86_64-unknown-linux-gnu/release/dfx | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
binary_path: target\x86_64-pc-windows-msvc\release\dfx.exe | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup environment variables | |
run: | | |
echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV | |
- name: Cache Cargo | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}-1 | |
- name: Build | |
run: | | |
cargo build --target ${{ matrix.target }} --locked --release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} | |
path: ${{ matrix.binary_path }} | |
list_tests: | |
if: needs.changes.outputs.sources == 'true' | |
needs: changes | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: set-matrix | |
run: echo "matrix=$(scripts/workflows/e2e-matrix.py)" >> $GITHUB_OUTPUT | |
smoke: | |
runs-on: ${{ matrix.os }} | |
if: needs.changes.outputs.sources == 'true' | |
needs: [changes, build_dfx] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-13-large, ubuntu-20.04, ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download dfx binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} | |
path: /usr/local/bin | |
- name: Setup dfx binary | |
run: chmod +x /usr/local/bin/dfx | |
- name: start and deploy | |
run: | | |
pwd | |
time dfx cache install | |
time dfx new smoke | |
cd smoke | |
time dfx start --background | |
time dfx deploy | |
time dfx canister call smoke_backend greet '("fire")' | |
time curl --fail http://localhost:"$(dfx info webserver-port)"/sample-asset.txt?canisterId=$(dfx canister id smoke_frontend) | |
time dfx stop | |
test: | |
runs-on: ${{ matrix.os }} | |
if: needs.changes.outputs.sources == 'true' | |
needs: [changes, build_dfx, list_tests] | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.list_tests.outputs.matrix)}} | |
env: | |
E2E_TEST: tests-${{ matrix.test }}.bash | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download dfx binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} | |
path: /usr/local/bin | |
- name: Setup dfx binary | |
run: chmod +x /usr/local/bin/dfx | |
- name: Provision Darwin | |
if: contains(matrix.os, 'macos') | |
run: bash scripts/workflows/provision-darwin.sh || bash scripts/workflows/provision-darwin.sh | |
- name: Provision Linux | |
if: contains(matrix.os, 'ubuntu') | |
run: bash scripts/workflows/provision-linux.sh || bash scripts/workflows/provision-linux.sh | |
- name: Prepare environment | |
run: | | |
echo "archive=$(pwd)/e2e/archive" >> "$GITHUB_ENV" | |
echo "assets=$(pwd)/e2e/assets" >> "$GITHUB_ENV" | |
echo "utils=$(pwd)/e2e/utils" >> "$GITHUB_ENV" | |
if [ "${{ matrix.backend == 'pocketic' || '' }}" ]; then | |
echo "USE_POCKETIC=1" >> "$GITHUB_ENV" | |
fi | |
export | |
- name: Download bats-support as a git submodule | |
run: git submodule update --init --recursive | |
- name: Cache mops files | |
uses: actions/cache@v4 | |
with: | |
path: | | |
e2e/assets/playground_backend/.mops | |
key: playground-backend-mops-${{ hashFiles('e2e/assets/playground_backend/mops.toml') }} | |
- name: Run e2e test | |
run: timeout 2400 bats "e2e/$E2E_TEST" | |
ui_test: | |
runs-on: ${{ matrix.os }} | |
if: needs.changes.outputs.sources == 'true' | |
needs: [changes, build_dfx] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-13-large, ubuntu-20.04, ubuntu-22.04] | |
steps: | |
- name: Checking out repo | |
uses: actions/checkout@v4 | |
- name: Setting up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: Installing playwright | |
run: | | |
pip install playwright==1.40.0 | |
playwright install | |
playwright install-deps | |
- name: Download dfx binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} | |
path: /usr/local/bin | |
- name: Setup dfx binary | |
run: chmod +x /usr/local/bin/dfx | |
- name: Deploy default dfx project | |
run: | | |
dfx new e2e_project | |
cd e2e_project | |
dfx start --background --clean | |
dfx deploy 2>&1 | tee deploy.log | |
echo FRONTEND_URL=$(grep "_frontend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV | |
echo CANDID_URL=$(grep "_backend:" deploy.log | grep -Eo "(http|https)://[a-zA-Z0-9./?=_&%:-]*") >> $GITHUB_ENV | |
- name: Running the Python script | |
run: | | |
python scripts/test-uis.py \ | |
--frontend_url "$FRONTEND_URL" \ | |
--candid_url "$CANDID_URL" \ | |
--browser chromium firefox webkit | |
export FRONTEND_URL_LOCALHOST="${FRONTEND_URL/127\.0\.0\.1/localhost}" | |
export CANDID_URL_LOCALHOST="${CANDID_URL/127\.0\.0\.1/localhost}" | |
python scripts/test-uis.py \ | |
--frontend_url "$FRONTEND_URL_LOCALHOST" \ | |
--candid_url "$CANDID_URL_LOCALHOST" \ | |
--browser chromium firefox webkit | |
aggregate: | |
name: e2e:required | |
if: always() && needs.changes.outputs.sources == 'true' | |
needs: [changes, test, smoke, ui_test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: check smoke test result | |
if: ${{ needs.smoke.result != 'success' }} | |
run: exit 1 | |
- name: check UI test result | |
if: ${{ needs.ui_test.result != 'success' }} | |
run: exit 1 | |
- name: check e2e test result | |
if: ${{ needs.test.result != 'success' }} | |
run: exit 1 |