|
57 | 57 | export PATH=$PATH:$(go env GOPATH)/bin
|
58 | 58 | addlicense -check .
|
59 | 59 |
|
| 60 | + test_data: |
| 61 | + name: build test data |
| 62 | + |
| 63 | + runs-on: ubuntu-20.04 |
| 64 | + |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v2 |
| 67 | + |
| 68 | + - name: Bazel cache |
| 69 | + uses: actions/cache@v2 |
| 70 | + with: |
| 71 | + path: | |
| 72 | + ~/.cache/bazel |
| 73 | + key: test_data-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl', 'bazel/cargo/wasmsign/crates.bzl') }} |
| 74 | + |
| 75 | + - name: Bazel build |
| 76 | + run: > |
| 77 | + bazel build |
| 78 | + --verbose_failures |
| 79 | + --test_output=errors |
| 80 | + -c opt |
| 81 | + $(bazel query 'kind(was.*_rust_binary, //test/test_data/...)') |
| 82 | +
|
| 83 | + - name: Upload test data |
| 84 | + uses: actions/upload-artifact@v2 |
| 85 | + with: |
| 86 | + name: test_data |
| 87 | + path: bazel-bin/test/test_data/*.wasm |
| 88 | + if-no-files-found: error |
| 89 | + retention-days: 3 |
| 90 | + |
| 91 | + - name: Cleanup Bazel cache |
| 92 | + run: | |
| 93 | + export OUTPUT=$(bazel info output_base) |
| 94 | + # Distfiles for Rust toolchains (350 MiB). |
| 95 | + rm -rf ${OUTPUT}/external/rust_*/*.tar.gz |
| 96 | + # Bazel's repository cache (650-800 MiB) and install base (155 MiB). |
| 97 | + rm -rf $(bazel info repository_cache) |
| 98 | + rm -rf $(bazel info install_base) |
| 99 | +
|
60 | 100 | build:
|
61 | 101 | name: ${{ matrix.action }} with ${{ matrix.name }}
|
62 | 102 |
|
| 103 | + needs: test_data |
| 104 | + |
63 | 105 | runs-on: ${{ matrix.os }}
|
64 | 106 |
|
65 | 107 | strategy:
|
@@ -147,6 +189,20 @@ jobs:
|
147 | 189 | ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
|
148 | 190 | ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}
|
149 | 191 |
|
| 192 | + - name: Download test data |
| 193 | + uses: actions/download-artifact@v2 |
| 194 | + with: |
| 195 | + name: test_data |
| 196 | + path: test/test_data/ |
| 197 | + |
| 198 | + - name: Mangle build rules to use existing test data |
| 199 | + run: > |
| 200 | + sed 's/\.wasm//g' test/BUILD > test/BUILD.tmp && mv test/BUILD.tmp test/BUILD; |
| 201 | + echo "package(default_visibility = [\"//visibility:public\"])" > test/test_data/BUILD; |
| 202 | + for i in $(cd test/test_data && ls -1 *.wasm | sed 's/\.wasm$//g'); |
| 203 | + do echo "filegroup(name = \"$i\", srcs = [\"$i.wasm\"])" >> test/test_data/BUILD; |
| 204 | + done |
| 205 | +
|
150 | 206 | - name: Bazel build/test
|
151 | 207 | run: >
|
152 | 208 | ${{ matrix.run_under }}
|
|
0 commit comments