fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Daniel Rainerci: rename step to `check`0d7d06f35

master
6.2 KiB173 linesraw
1name: Test
2
3on: [push, pull_request]
4
5env:
6  FISH_TEST_MAX_CONCURRENCY: "4"
7  CMAKE_BUILD_PARALLEL_LEVEL: "4"
8
9permissions:
10  contents: read
11
12jobs:
13  ubuntu:
14    runs-on: ubuntu-latest
15    steps:
16    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh
17    - uses: ./.github/actions/rust-toolchain@oldest-supported
18    - name: Install deps
19      uses: ./.github/actions/install-dependencies
20      with:
21        include_sphinx: true
22    - name: Generate a locale that uses a comma as decimal separator.
23      run: |
24        sudo locale-gen fr_FR.UTF-8
25    - name: cmake
26      run: |
27        mkdir build && cd build
28        cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
29    - name: make
30      run: |
31        make -C build VERBOSE=1
32    - name: make fish_run_tests
33      run: |
34        make -C build VERBOSE=1 fish_run_tests
35
36  ubuntu-32bit-static-pcre2:
37    runs-on: ubuntu-latest
38    steps:
39    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh
40    - uses: ./.github/actions/rust-toolchain@oldest-supported
41      with:
42        targets: "i586-unknown-linux-gnu"
43    - name: Update package database
44      run: sudo apt-get update
45    - name: Install deps
46      uses: ./.github/actions/install-dependencies
47      with:
48        include_pcre: false
49        include_sphinx: false
50    - name: Install g++-multilib
51      run: sudo apt install g++-multilib
52    - name: cmake
53      env:
54          CFLAGS: "-m32"
55      run: |
56        mkdir build && cd build
57        cmake -DFISH_USE_SYSTEM_PCRE2=OFF -DRust_CARGO_TARGET=i586-unknown-linux-gnu ..
58    - name: make
59      run: |
60        make -C build VERBOSE=1
61    - name: make fish_run_tests
62      run: |
63        make -C build VERBOSE=1 fish_run_tests
64
65  ubuntu-asan:
66    runs-on: ubuntu-latest
67    env:
68        # Rust has two different memory sanitizers of interest; they can't be used at the same time:
69        # * AddressSanitizer detects out-of-bound access, use-after-free, use-after-return,
70        #   use-after-scope, double-free, invalid-free, and memory leaks.
71        # * MemorySanitizer detects uninitialized reads.
72        #
73        RUSTFLAGS: "-Zsanitizer=address"
74        # RUSTFLAGS: "-Zsanitizer=memory -Zsanitizer-memory-track-origins"
75    steps:
76    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh
77    # All -Z options require running nightly
78    - uses: dtolnay/rust-toolchain@nightly
79      with:
80        # ASAN uses `cargo build -Zbuild-std` which requires the rust-src component
81        # this is comma-separated
82        components: rust-src
83    - name: Update package database
84      run: sudo apt-get update
85    - name: Install deps
86      uses: ./.github/actions/install-dependencies
87      with:
88        include_sphinx: false
89    - name: Install llvm
90      run: |
91        sudo apt install llvm # for llvm-symbolizer
92    - name: cmake
93      env:
94          CC: clang
95      run: |
96        mkdir build && cd build
97        # Rust's ASAN requires the build system to explicitly pass a --target triple. We read that
98        # value from CMake variable Rust_CARGO_TARGET.
99        cmake .. -DASAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu -DCMAKE_BUILD_TYPE=Debug
100    - name: make
101      run: |
102        make -C build VERBOSE=1
103    - name: make fish_run_tests
104      env:
105          FISH_CI_SAN: 1
106          ASAN_OPTIONS: check_initialization_order=1:detect_stack_use_after_return=1:detect_leaks=1:fast_unwind_on_malloc=0
107          # use_tls=0 is a workaround for LSAN crashing with "Tracer caught signal 11" (SIGSEGV),
108          # which seems to be an issue with TLS support in newer glibc versions under virtualized
109          # environments. Follow https://github.com/google/sanitizers/issues/1342 and
110          # https://github.com/google/sanitizers/issues/1409 to track this issue.
111          # UPDATE: this can cause spurious leak reports for __cxa_thread_atexit_impl() under glibc.
112          LSAN_OPTIONS: verbosity=0:log_threads=0:use_tls=1:print_suppressions=0
113      run: |
114        set -x
115        export ASAN_SYMBOLIZER_PATH=$(command -v /usr/bin/llvm-symbolizer* | sort -n | head -1)
116        export LSAN_OPTIONS="$LSAN_OPTIONS:suppressions=$PWD/build_tools/lsan_suppressions.txt"
117        make -C build VERBOSE=1 fish_run_tests
118
119  macos:
120    runs-on: macos-latest
121    env:
122      # macOS runners keep having issues loading Cargo.toml dependencies from git (GitHub) instead
123      # of crates.io, so give this a try. It's also sometimes significantly faster on all platforms.
124      CARGO_NET_GIT_FETCH_WITH_CLI: true
125    steps:
126    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh
127    - uses: ./.github/actions/rust-toolchain@oldest-supported
128    - name: Install deps
129      run: |
130        # --break-system-packages because homebrew has now declared itself "externally managed".
131        # this is CI so we don't actually care.
132        sudo pip3 install --break-system-packages pexpect
133        brew install gettext tmux
134    - uses: ./.github/actions/install-sphinx
135    - name: cmake
136      run: |
137        mkdir build && cd build
138        FISH_TEST_MAX_CONCURRENCY=1 \
139          cmake -DCMAKE_BUILD_TYPE=Debug ..
140    - name: make
141      run: |
142        make -C build VERBOSE=1
143    - name: make fish_run_tests
144      run: |
145        make -C build VERBOSE=1 fish_run_tests
146
147  windows:
148    runs-on: windows-latest
149    defaults:
150      run:
151        shell: msys2 {0}
152    steps:
153    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, build_tools/update-dependencies.sh
154    - uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1, build_tools/update-dependencies.sh
155      with:
156        update: true
157        msystem: MSYS
158      id: msys2
159    - name: Install deps
160      # Not using setup-msys2 `install` option to make it easier to copy/paste
161      run: |
162        pacman --noconfirm -S --needed git rust python3 diffutils tmux
163    - name: rebase
164      env:
165        MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
166      shell: cmd
167      run: |
168        "%MSYS2_LOCATION%\usr\bin\dash" /usr/bin/rebaseall -p -v
169    - name: check
170      env:
171        FISH_CHECK_LINT: false
172      run: |
173        cargo xtask check