]> git.proxmox.com Git - wasi-libc.git/blob - .github/workflows/main.yml
17ef735c7f10c1c22080e2747631fb0872638d3e
[wasi-libc.git] / .github / workflows / main.yml
1 name: CI
2 on: [push, pull_request]
3
4 jobs:
5 buildlibc:
6 name: Build libc
7 runs-on: ${{ matrix.os }}
8 strategy:
9 matrix:
10 os: [ubuntu-latest, macos-latest, windows-latest]
11 # oldest and newest supported LLVM version
12 clang_version: [10.0.0, 14.0.0]
13 steps:
14 - uses: actions/checkout@v1
15 with:
16 submodules: true
17
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
25 - name: Install LLVM tools (Windows)
26 shell: bash
27 run: |
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"
30 echo "$(pwd)/llvm/bin" >> $GITHUB_PATH
31 echo "CC=$(pwd)/llvm/bin/clang.exe" >> $GITHUB_ENV
32 echo "AR=$(pwd)/llvm/bin/llvm-ar.exe" >> $GITHUB_ENV
33 echo "NM=$(pwd)/llvm/bin/llvm-nm.exe" >> $GITHUB_ENV
34 if: matrix.os == 'windows-latest'
35
36 - name: Override llvm-nm with one from rustup (Windows)
37 run: |
38 rustup update stable
39 rustup default stable
40 rustup component add llvm-tools-preview
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
42 if: matrix.os == 'windows-latest'
43
44 - name: Install LLVM tools (MacOS)
45 shell: bash
46 run: |
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
49 echo "$CLANG_DIR" >> $GITHUB_PATH
50 echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV
51 echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV
52 echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV
53 if: matrix.os == 'macos-latest'
54
55 - name: Install LLVM tools (Linux)
56 shell: bash
57 run: |
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
60 echo "$CLANG_DIR" >> $GITHUB_PATH
61 echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV
62 echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV
63 echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV
64 if: matrix.os == 'ubuntu-latest'
65
66 - name: Build libc
67 shell: bash
68 run: make -j4
69
70 - uses: actions/upload-artifact@v1
71 with:
72 # Upload the sysroot folder. Give it a name according to the OS it was built for.
73 name: ${{ format( 'sysroot-{0}.tgz', matrix.os) }}
74 path: sysroot
75
76 - name: Build libc + threads
77 # Only build the thread-capable wasi-libc in the latest supported Clang
78 # version; the earliest version does not have all necessary builtins
79 # (e.g., `__builtin_wasm_memory_atomic_notify`).
80 if: matrix.clang_version != '10.0.0'
81 shell: bash
82 run: make -j4 THREAD_MODEL=posix
83
84 # Disable the headerstest job for now, while WASI transitions from the
85 # witx snapshots to wit proposals, and we have a few manual edits to the
86 # generated header to make life easier for folks.
87 headerstest:
88 if: ${{ false }} # Disable the headers test for now.
89 name: wasi-headers test
90 runs-on: ${{ matrix.os }}
91 strategy:
92 matrix:
93 os: [ubuntu-latest, macos-latest, windows-latest]
94 steps:
95 - uses: actions/checkout@v1
96 with:
97 submodules: true
98 - name: Install Rust (rustup)
99 shell: bash
100 run: rustup update stable --no-self-update && rustup default stable
101 if: matrix.os != 'macos-latest'
102 - name: Install Rust (macos)
103 run: |
104 curl https://sh.rustup.rs | sh -s -- -y
105 echo "$HOME/.cargo/bin" >> $GITHUB_PATH
106 if: matrix.os == 'macos-latest'
107 - run: cargo fetch
108 working-directory: tools/wasi-headers
109 - run: cargo build
110 working-directory: tools/wasi-headers
111 - run: cargo test
112 working-directory: tools/wasi-headers
113
114 rustfmt:
115 name: Rustfmt
116 runs-on: ubuntu-latest
117 steps:
118 - uses: actions/checkout@v1
119 with:
120 submodules: true
121 - name: Install Rust
122 run: rustup update stable && rustup default stable && rustup component add rustfmt
123 - run: cargo fmt -- --check
124 working-directory: tools/wasi-headers