-
Notifications
You must be signed in to change notification settings - Fork 52
123 lines (103 loc) · 3.66 KB
/
ci-wrap-test-harness.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
name: CI-Wrap-Test-Harness
on:
workflow_call:
outputs:
rebuild_required:
description: "If it is necessary to rebuild the wrap-test-harness with the latest build of the toolchain."
value: ${{ jobs.Rebuild-Required.outputs.required }}
jobs:
Rebuild-Required:
runs-on: ubuntu-latest
outputs:
required: ${{ env.required }}
branch: ${{ env.branch }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
packages/cli/src/commands/build.ts
packages/cli/src/lib/Compiler.ts
packages/cli/src/lib/defaults/build-strategies/*
packages/schema/bind/*
packages/wasm/*
packages/js/wasm/*
packages/js/asyncify/*
packages/js/manifests/*
WRAP_TEST_HARNESS
- name: Get Test Harness Branch
run: echo branch=$(cat WRAP_TEST_HARNESS) >> $GITHUB_ENV
- id: set-output
run: echo "required=${{steps.changed-files.outputs.any_changed}}" >> $GITHUB_ENV
Rebuild-Test-Wrappers:
runs-on: ubuntu-latest
needs: Rebuild-Required
if: ${{ needs.Rebuild-Required.outputs.required == 'true' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: polywrap/wrap-test-harness
ref: ${{ needs.Rebuild-Required.outputs.branch }}
fetch-depth: 0
- name: Checkout Repository
uses: actions/checkout@v2
with:
path: toolchain
fetch-depth: 0
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
working-directory: ./toolchain
- name: Setup Node.js
uses: actions/setup-node@master
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --nonInteractive --frozen-lockfile --prefer-offline
working-directory: ./toolchain
- name: Build toolchain
run: yarn build
working-directory: ./toolchain
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-06-15
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/
./target/
key: cargo-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-${{ github.job }}
- name: Set environment variable
run: echo POLYWRAP_CLI_PATH=$(pwd)/toolchain/packages/cli >> $GITHUB_ENV
- name: Set environment variable
run: echo POLYWRAP_WASM_PATH=$(pwd)/toolchain/packages/wasm >> $GITHUB_ENV
- name: Modify permissions of cargo registry
run: sudo chown -R runner:runner ${HOME}/.cargo/registry
- name: Run wrappers build
run: cargo run -- -w
env:
POLYWRAP_CLI_PATH: ${{env.POLYWRAP_CLI_PATH}}
POLYWRAP_WASM_PATH: ${{env.POLYWRAP_WASM_PATH}}
- uses: actions/upload-artifact@v3
with:
name: rebuilt-wrappers
path: ./wrappers