Repository navigation
110 lines (89 loc) · 3.6 KB
/
Copy pathe2e-test-nodejs.yml
File metadata and controls
110 lines (89 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: test
on:
merge_group:
pull_request:
jobs:
unit_test:
name: unit_test:required
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main
- name: Setup
run: pnpm run setup
- name: Test
run: pnpm test:pic
# The lockfile pins a newer @icp-sdk/core, so repeat the build and tests
# against the lowest version the peer range admits.
- name: Test against the @icp-sdk/core peer floor
run: |
range=$(node -p "require('./packages/pic/package.json').peerDependencies['@icp-sdk/core']")
floor=$(pnpm view "@icp-sdk/core@$range" version --json | node -p '[].concat(JSON.parse(require("fs").readFileSync(0, "utf8")))[0]')
echo "Testing against @icp-sdk/core@$floor (peer range $range)"
pnpm --filter @dfinity/pic add -D "@icp-sdk/core@$floor"
pnpm build
pnpm test:pic
e2e_test_nodejs:
name: e2e_test_nodejs:required
runs-on: ubuntu-latest
# Provides icp-cli, ic-wasm, mops and Rust with the wasm32 target.
container: ghcr.io/dfinity/icp-dev-env-all:v2.3.0
steps:
- name: Checkout Code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main
- name: Setup
run: pnpm run setup
- name: Cache Mops
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.cache/mops
.mops
key: mops-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mops.toml', 'mops.lock') }}
- name: Install Motoko dependencies
run: mops install
# hashFiles runs on the host, where a ** glob fails on the pnpm symlinks
# created inside the container, so the cache keys list exact paths.
- name: Cache Cargo
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
/usr/local/cargo/registry
target
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
# Installs the toolchain pinned in rust-toolchain.toml before the examples
# are built in parallel, which would otherwise each try to install it.
- name: Install Rust toolchain
run: rustup toolchain install
- name: Build
run: pnpm run build
- name: Build Examples
run: pnpm build:examples
- name: Test Examples
run: pnpm test:examples
consumer_install:
name: consumer_install:required
strategy:
fail-fast: false
matrix:
package-manager: [npm, pnpm, yarn, bun]
# The opt-in mechanisms are not platform specific.
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@a98f5d0198719ad41ded2f02fa0f5e426102f369 # main
- name: Setup Bun
if: matrix.package-manager == 'bun'
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: '.bun-version'
- name: Build
run: pnpm run build
- name: Install the packed package and run it
run: ./scripts/smoke-test-install.sh ${{ matrix.package-manager }}