Skip to content

refactor: concrete error type for Identity::new (#3381) #5974

refactor: concrete error type for Identity::new (#3381)

refactor: concrete error type for Identity::new (#3381) #5974

Workflow file for this run

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 ]
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
steps:
- uses: actions/checkout@v3
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@v3
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@v3
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@v3
- 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:
backend: ["ic-ref", "replica"]
# 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@v3
- name: Download dfx binary
uses: actions/download-artifact@v3
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
if [ "${{ matrix.backend}}" = "ic-ref" ]; then
time dfx start --emulator --background
else
time dfx start --background
fi
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@v3
- name: Download dfx binary
uses: actions/download-artifact@v3
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@v3
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"
aggregate:
name: e2e:required
if: ${{ always() }}
needs: [test, smoke]
runs-on: ubuntu-latest
steps:
- name: check smoke test result
if: ${{ needs.smoke.result != 'success' }}
run: exit 1
- name: check e2e test result
if: ${{ needs.test.result != 'success' }}
run: exit 1