This repository was archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
295 lines (291 loc) · 11.4 KB
/
main.yaml
File metadata and controls
295 lines (291 loc) · 11.4 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: tests and release builds
env:
RUST_BACKTRACE: 1
on:
push:
branches:
- 'master'
- '**'
tags:
# this is _not_ a regex, see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
- '[0-9]+.[0-9]+.[0-9]+*'
jobs:
setup:
name: Set up
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.setup.outputs.VERSION }}
DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }}
steps:
- name: Set up env vars
id: setup
shell: bash
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
echo ::set-output name=VERSION::${VERSION}
DOING_RELEASE=$(echo $VERSION | grep -c '[0-9]\+\.[0-9]\+\.[0-9]\+\(-.*\)\?' || true)
echo ::set-output name=DOING_RELEASE::${DOING_RELEASE}
echo $VERSION
echo $DOING_RELEASE
test:
name: Test on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
needs: setup
strategy:
fail-fast: false
matrix:
build: [linux, macos-x86_64, macos-aarch64, windows]
include:
- build: linux
os: ubuntu-latest
rust: stable
artifact_name: 'wapm-linux-amd64'
- build: macos-x86_64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
artifact_name: 'wapm-darwin-amd64'
- build: macos-aarch64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
artifact_name: 'wapm-darwin-aarch64'
- build: windows
os: windows-latest
rust: stable
artifact_name: 'wapm-windows-amd64'
#- build: linux-musl-x64
# os: ubuntu-latest
# container: alpine:latest
# rust: stable
# artifact_name: 'wapm-linux-musl-amd64'
# env:
# CARGO_SCCACHE_VERSION: 0.2.10
# SCCACHE_AZURE_BLOB_CONTAINER: ${{ secrets.SCCACHE_AZURE_BLOB_CONTAINER }}
# SCCACHE_AZURE_CONNECTION_STRING: ${{ secrets.SCCACHE_AZURE_CONNECTION_STRING }}
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Configure cargo data directory + private access tokens
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
# that are needed during the build process. Additionally, this works
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: |
echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
echo https://wasmer:${{ secrets.GH_PAT }}@github.com > creds.txt
git config --global credential.helper "store --file creds.txt"
# - name: Install sccache
# run: |
# echo "::add-path::${{ runner.tool_cache }}/cargo-sccache/bin"
# cargo install sccache --version ${{ env.CARGO_SCCACHE_VERSION }} --root ${{ runner.tool_cache }}/cargo-sccache
# - name: Start sccache
# run: |
# ${{ runner.tool_cache }}/cargo-sccache/bin/sccache --start-server
# ${{ runner.tool_cache }}/cargo-sccache/bin/sscache -s
# echo "::set-env name=RUSTC_WRAPPER::${{ runner.tool_cache }}/cargo-sccache/bin/sccache"
- name: Setup Rust target
if: matrix.target
run: |
mkdir -p .cargo
cat << EOF > .cargo/config.toml
[build]
target = "${{ matrix.target }}"
EOF
#- name: Set up base deps on musl
# if: matrix.build == 'linux-musl-x64'
# run: |
# apk add build-base musl-dev curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++ libxkbcommon-dev wayland-dev
- name: Install Cmake (Windows)
if: matrix.os == 'windows-latest'
run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
- name: Install cmake (macOS)
if: matrix.target == 'x86_64-apple-darwin'
shell: bash
run: |
set -ex
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin"
export PATH=$CMAKE_BIN_PATH:$PATH
- name: Install cmake (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz
tar xf cmake-3.4.1-Linux-x86_64.tar.gz
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Linux-x86_64/CMake.app/Contents/bin"
export PATH=$CMAKE_BIN_PATH:$PATH
- name: Tests
if: matrix.target != 'aarch64-apple-darwin'
run: |
cargo test --verbose --features "update-notifications" -- --test-threads=1
- name: Integration Tests
if: matrix.target != 'aarch64-apple-darwin'
run: |
make integration-tests
- name: Tests (Wasm Interface)
if: matrix.target != 'aarch64-apple-darwin'
run: |
cargo test --manifest-path lib/wasm-interface/Cargo.toml
- name: Check
if: matrix.target != 'aarch64-apple-darwin'
run: |
cargo check --features "telemetry update-notifications"
- name: Build binary
run: |
make release
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: dist/wapm-cli.tar.gz
if-no-files-found: error
retention-days: 3
# - name: Cache
# uses: actions/cache@master
# with:
# # Note: crates from the git repo always get rebuilt
# # so we cache only those subdirectories of target/{debug|release} that
# # contain the build output for crates that come from the registry.
# path: |-
# .cargo_home
# target/*/.*
# target/*/build
# target/*/deps
# key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
- name: Release to crates.io
if: needs.setup.outputs.DOING_RELEASE == '1' && matrix.os == 'ubuntu-latest'
run: |
cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
regression_tests:
strategy:
fail-fast: false
needs: [setup, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Wasmer
run: |
curl https://get.wasmer.io -sSfL | sh
- name: Download the Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Set up for tests
run: |
rm -f /home/runner/.wasmer/bin/wapm
tar -xzf `pwd`/artifacts/wapm-linux-amd64/wapm-cli.tar.gz
cp ./bin/wapm /home/runner/.wasmer/bin/wapm
chmod +x /home/runner/.wasmer/bin/wapm
- name: 'Regression test: direct execution works'
shell: bash
run: |
chmod +x end-to-end-tests/ci/direct-execution.sh
./end-to-end-tests/ci/direct-execution.sh
- name: 'Regression test: Install, Uninstall, Run, and List'
shell: bash
run: |
chmod +x end-to-end-tests/ci/install.sh
./end-to-end-tests/ci/install.sh
- name: 'Regression test: verification and public key management'
shell: bash
run: |
chmod +x end-to-end-tests/ci/verification.sh
./end-to-end-tests/ci/verification.sh
# - name: 'Regression test: pkg_fs works globally and when installed locally'
# shell: bash
# run: |
# chmod +x end-to-end-tests/ci/package-fs-mapping.sh
# ./end-to-end-tests/ci/package-fs-mapping.sh
- name: 'Regression test: manifest validation rejects invalid manifests'
shell: bash
run: |
chmod +x end-to-end-tests/ci/manifest-validation.sh
./end-to-end-tests/ci/manifest-validation.sh
- name: 'Regression test: package fs and command rename'
shell: bash
run: |
chmod +x end-to-end-tests/ci/validate-global.sh
./end-to-end-tests/ci/validate-global.sh
- name: 'Regression test: Init a Manifest and Add some dependencies'
shell: bash
run: |
chmod +x end-to-end-tests/ci/init-and-add.sh
./end-to-end-tests/ci/init-and-add.sh
release:
needs: [setup, test] #, regression_tests]
runs-on: ubuntu-latest
if: needs.setup.outputs.DOING_RELEASE == '1'
steps:
- name: Download the Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.VERSION }}
release_name: Release ${{ needs.setup.outputs.VERSION }}
draft: true
prerelease: false
- name: Upload Release Asset Windows
id: upload-release-asset-windows-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/wapm-windows-amd64/wapm-cli.tar.gz
asset_name: wapm-cli-windows-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux amd64
id: upload-release-asset-linux-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/wapm-linux-amd64/wapm-cli.tar.gz
asset_name: wapm-cli-linux-amd64.tar.gz
asset_content_type: application/gzip
#- name: Upload Release Asset Linux amd64 (musl)
# id: upload-release-asset-linux-musl-amd64
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: artifacts/wapm-linux-musl-amd64/wapm-cli.tar.gz
# asset_name: wapm-cli-linux-musl-amd64.tar.gz
# asset_content_type: application/gzip
- name: Upload Release Asset Mac amd64
id: upload-release-asset-mac-darwin-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/wapm-darwin-amd64/wapm-cli.tar.gz
asset_name: wapm-cli-darwin-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Mac aarch64
id: upload-release-asset-mac-darwin-aarch64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/wapm-darwin-aarch64/wapm-cli.tar.gz
asset_name: wapm-cli-darwin-aarch64.tar.gz
asset_content_type: application/gzip