feat: build windows executable #6694
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: | |
build_dfx: | |
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-12, ubuntu-20.04, ubuntu-22.04, windows-2022 ] | |
include: | |
- os: macos-12 | |
target: x86_64-apple-darwin | |
binary_path: target/x86_64-apple-darwin/release | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
binary_path: target/x86_64-unknown-linux-gnu/release | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
binary_path: target/x86_64-unknown-linux-gnu/release | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
binary_path: target/x86_64-pc-windows-msvc/release | |
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: Install Rust | |
run: rustup show | |
if: contains(matrix.os, 'macos') | |
- name: Build | |
run: | | |
cargo build --target ${{ matrix.target }} --locked --release | |
- name: Strip binaries | |
run: | | |
cd ${{ matrix.binary_path }} | |
sudo chown -R $(whoami) . | |
strip dfx | |
if: contains(matrix.os, 'ubuntu') | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }} | |
path: ${{ matrix.binary_path }}/dfx | |
list_tests: | |
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 }} | |
needs: build_dfx | |
strategy: | |
fail-fast: false | |
matrix: | |
# macos-latest is currently macos-11, ubuntu-latest is currently ubuntu-20.04 | |
# ubuntu-18.04 not supported due to: | |
# /home/runner/.cache/dfinity/versions/0.8.3-34-g36e39809/ic-starter: | |
# /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found | |
os: [macos-12, 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: Disable query verification in ic-ref | |
if: ${{ matrix.backend == 'ic-ref' }} | |
run: | | |
echo DFX_DISABLE_QUERY_VERIFICATION=1 >> $GITHUB_ENV | |
- 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 }} | |
needs: [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 | |
- name: Provision Linux | |
if: contains(matrix.os, 'ubuntu') | |
run: 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" | |
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 }} | |
needs: [build_dfx] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, 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: [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 |