Skip to content

Commit

Permalink
Merge branch 'master' into ping-json
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine authored Feb 7, 2024
2 parents e7f0edb + 0b1f94e commit 39ad134
Show file tree
Hide file tree
Showing 189 changed files with 5,108 additions and 3,087 deletions.
61 changes: 10 additions & 51 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ name: Audit
on:
push:
branches:
- master
- main
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 14 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -13,59 +16,15 @@ concurrency:
env:
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .

jobs:
build_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: echo "matrix=$(scripts/workflows/audit-matrix.py)" >> $GITHUB_OUTPUT

test:
name: audit
runs-on: ${{ matrix.os }}
needs: [ build_matrix ]
strategy:
matrix: ${{fromJson(needs.build_matrix.outputs.matrix)}}

steps:
- uses: actions/checkout@v3
with:
path: sdk
- uses: actions/checkout@v3
with:
repository: 'RustSec/advisory-db'
path: advisory-db
ref: ${{ matrix.advisory-db-rev }}

- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup show
- name: Audit
# ignores RUSTSEC-2020-0071 because it is 'only' in a dev dependency (ic-certified-responses -> ic-types -> chrono -> time)
run: |
cd sdk
cargo audit --no-fetch --db "${GITHUB_WORKSPACE}"/advisory-db --ignore RUSTSEC-2020-0071
env:
RUST_BACKTRACE: 1

aggregate:
name: audit:required
if: ${{ always() }}
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
issues: write

steps:
- name: check step result directly
if: ${{ needs.test.result != 'success' }}
run: exit 1
- uses: actions/checkout@v4
- uses: actions-rust-lang/audit@v1
4 changes: 2 additions & 2 deletions .github/workflows/broadcast-frontend-hash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: sudo apt-get install --yes moreutils

- name: Checkout dfinity/sdk repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # workaround to fetch all tags: https://github.com/actions/checkout/issues/701
path: sdk
Expand All @@ -40,7 +40,7 @@ jobs:
echo "NEW_HASH=$(shasum -a 256 src/distributed/assetstorage.wasm.gz | cut -f1 -d" ")" >> $GITHUB_ENV
- name: Checkout dfinity/motoko-playground repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.NIV_UPDATER_TOKEN }}
repository: ${{ env.PLAYGROUND_REPO }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-frontend-canister.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
name: frontend-canister-up-to-date:required
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build frontend canister
run: |
./scripts/update-frontend-canister.sh --release-build
- name: Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: assetstorage
path: ${{ github.workspace }}/src/distributed/assetstorage.wasm.gz
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/consistent-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-21.05-small
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: license-check:required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check bans licenses sources # skip advisories, which are handled by audit.yml
75 changes: 64 additions & 11 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
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 ]
os: [ macos-12, ubuntu-20.04, ubuntu-22.04, windows-2022 ]
include:
- os: macos-12
target: x86_64-apple-darwin
Expand All @@ -34,15 +34,18 @@ jobs:
- 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@v3
- 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@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -62,7 +65,7 @@ jobs:
strip dfx
if: contains(matrix.os, 'ubuntu')
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }}
path: ${{ matrix.binary_path }}/dfx
Expand All @@ -72,7 +75,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- id: set-matrix
run: echo "matrix=$(scripts/workflows/e2e-matrix.py)" >> $GITHUB_OUTPUT

Expand All @@ -88,9 +91,9 @@ jobs:
# /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
- uses: actions/checkout@v4
- name: Download dfx binary
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }}
path: /usr/local/bin
Expand Down Expand Up @@ -121,9 +124,9 @@ jobs:
env:
E2E_TEST: tests-${{ matrix.test }}.bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Download dfx binary
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dfx-${{ matrix.os }}-rs-${{ hashFiles('rust-toolchain.toml') }}
path: /usr/local/bin
Expand All @@ -144,23 +147,73 @@ jobs:
- name: Download bats-support as a git submodule
run: git submodule update --init --recursive
- name: Cache mops files
uses: actions/cache@v3
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]
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
4 changes: 2 additions & 2 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
os: [ ubuntu-latest ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache Cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/niv-updater.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/prepare-dfx-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand Down
Loading

0 comments on commit 39ad134

Please sign in to comment.