]>
Commit | Line | Data |
---|---|---|
cd74e1d9 DG |
1 | name: CI |
2 | on: [push, pull_request] | |
3 | ||
4 | jobs: | |
9580a259 PH |
5 | buildlibc: |
6 | name: Build libc | |
7 | runs-on: ${{ matrix.os }} | |
8 | strategy: | |
9 | matrix: | |
10 | os: [ubuntu-latest, macos-latest, windows-latest] | |
7a21011e | 11 | # oldest and newest supported LLVM version |
12 | clang_version: [10.0.0, 14.0.0] | |
9580a259 PH |
13 | steps: |
14 | - uses: actions/checkout@v1 | |
15 | with: | |
16 | submodules: true | |
17 | ||
697d5f84 DG |
18 | - name: Install libtinfo5 |
19 | run: | | |
20 | set -ex | |
21 | sudo apt-get update | |
22 | sudo apt-get install -y libtinfo5 | |
23 | if: matrix.os == 'ubuntu-latest' | |
24 | ||
61786461 | 25 | - name: Install LLVM tools (Windows) |
9580a259 PH |
26 | shell: bash |
27 | run: | | |
7a21011e | 28 | curl -fsSLO https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/LLVM-${{ matrix.clang_version }}-win64.exe |
29 | 7z x LLVM-${{ matrix.clang_version }}-win64.exe -y -o"llvm" | |
61786461 | 30 | echo "$(pwd)/llvm/bin" >> $GITHUB_PATH |
9e09e02a | 31 | echo "CC=$(pwd)/llvm/bin/clang.exe" >> $GITHUB_ENV |
9eb4a995 | 32 | echo "AR=$(pwd)/llvm/bin/llvm-ar.exe" >> $GITHUB_ENV |
a279514a | 33 | echo "NM=$(pwd)/llvm/bin/llvm-nm.exe" >> $GITHUB_ENV |
9580a259 PH |
34 | if: matrix.os == 'windows-latest' |
35 | ||
61786461 | 36 | - name: Override llvm-nm with one from rustup (Windows) |
9580a259 | 37 | run: | |
9ca51871 | 38 | rustup update stable |
9580a259 PH |
39 | rustup default stable |
40 | rustup component add llvm-tools-preview | |
a279514a | 41 | echo "NM=$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe" >> $GITHUB_ENV |
9580a259 PH |
42 | if: matrix.os == 'windows-latest' |
43 | ||
61786461 | 44 | - name: Install LLVM tools (MacOS) |
9580a259 PH |
45 | shell: bash |
46 | run: | | |
7a21011e | 47 | curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-x86_64-apple-darwin.tar.xz | tar xJf - |
48 | export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-x86_64-apple-darwin/bin | |
9083fe84 | 49 | echo "$CLANG_DIR" >> $GITHUB_PATH |
9e09e02a | 50 | echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV |
9eb4a995 | 51 | echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV |
a279514a | 52 | echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV |
9580a259 PH |
53 | if: matrix.os == 'macos-latest' |
54 | ||
61786461 | 55 | - name: Install LLVM tools (Linux) |
9580a259 PH |
56 | shell: bash |
57 | run: | | |
7a21011e | 58 | curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-x86_64-linux-gnu-ubuntu-18.04.tar.xz | tar xJf - |
59 | export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-x86_64-linux-gnu-ubuntu-18.04/bin | |
9083fe84 | 60 | echo "$CLANG_DIR" >> $GITHUB_PATH |
8098d862 | 61 | echo "CLANG_DIR=$CLANG_DIR" >> $GITHUB_ENV |
9e09e02a | 62 | echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV |
9eb4a995 | 63 | echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV |
a279514a | 64 | echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV |
9580a259 PH |
65 | if: matrix.os == 'ubuntu-latest' |
66 | ||
67 | - name: Build libc | |
68 | shell: bash | |
69 | run: make -j4 | |
70 | ||
8098d862 AB |
71 | - name: Test |
72 | shell: bash | |
73 | # For Clang linking to work correctly, we need to place Clang's runtime | |
74 | # library for `wasm32-wasi` in the right location (i.e., the `mkdir` and | |
75 | # `cp` below). | |
76 | run: | | |
77 | cd test | |
78 | make download | |
79 | export WASI_DIR=$(realpath $CLANG_DIR/../lib/clang/${{ matrix.clang_version }}/lib/wasi/) | |
80 | mkdir -p $WASI_DIR | |
81 | cp download/lib/wasi/libclang_rt.builtins-wasm32.a $WASI_DIR | |
82 | make test | |
83 | # The older version of Clang does not provide the expected symbol for the | |
84 | # test entrypoints: `undefined symbol: __main_argc_argv`. | |
85 | if: matrix.os == 'ubuntu-latest' && matrix.clang_version != '10.0.0' | |
86 | ||
9580a259 PH |
87 | - uses: actions/upload-artifact@v1 |
88 | with: | |
89 | # Upload the sysroot folder. Give it a name according to the OS it was built for. | |
90 | name: ${{ format( 'sysroot-{0}.tgz', matrix.os) }} | |
91 | path: sysroot | |
92 | ||
dcd28cf8 AB |
93 | - name: Build libc + threads |
94 | # Only build the thread-capable wasi-libc in the latest supported Clang | |
95 | # version; the earliest version does not have all necessary builtins | |
96 | # (e.g., `__builtin_wasm_memory_atomic_notify`). | |
97 | if: matrix.clang_version != '10.0.0' | |
98 | shell: bash | |
99 | run: make -j4 THREAD_MODEL=posix | |
100 | ||
2f24a36e DG |
101 | # Disable the headerstest job for now, while WASI transitions from the |
102 | # witx snapshots to wit proposals, and we have a few manual edits to the | |
103 | # generated header to make life easier for folks. | |
9580a259 | 104 | headerstest: |
2f24a36e | 105 | if: ${{ false }} # Disable the headers test for now. |
9580a259 | 106 | name: wasi-headers test |
cd74e1d9 DG |
107 | runs-on: ${{ matrix.os }} |
108 | strategy: | |
109 | matrix: | |
110 | os: [ubuntu-latest, macos-latest, windows-latest] | |
111 | steps: | |
8b3266db | 112 | - uses: actions/checkout@v1 |
cd74e1d9 DG |
113 | with: |
114 | submodules: true | |
115 | - name: Install Rust (rustup) | |
116 | shell: bash | |
117 | run: rustup update stable --no-self-update && rustup default stable | |
118 | if: matrix.os != 'macos-latest' | |
119 | - name: Install Rust (macos) | |
120 | run: | | |
121 | curl https://sh.rustup.rs | sh -s -- -y | |
9083fe84 | 122 | echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
cd74e1d9 DG |
123 | if: matrix.os == 'macos-latest' |
124 | - run: cargo fetch | |
125 | working-directory: tools/wasi-headers | |
126 | - run: cargo build | |
127 | working-directory: tools/wasi-headers | |
128 | - run: cargo test | |
129 | working-directory: tools/wasi-headers | |
130 | ||
131 | rustfmt: | |
132 | name: Rustfmt | |
133 | runs-on: ubuntu-latest | |
134 | steps: | |
8b3266db | 135 | - uses: actions/checkout@v1 |
cd74e1d9 DG |
136 | with: |
137 | submodules: true | |
138 | - name: Install Rust | |
139 | run: rustup update stable && rustup default stable && rustup component add rustfmt | |
140 | - run: cargo fmt -- --check | |
141 | working-directory: tools/wasi-headers |