ci.yml
This file
Path
.github/workflows/ci.yml
271 lines · 9.0 KiB · YAML
Last changed by
cargo: add new build-time `unstable-index` featureAndrew Gallantbefore adoptiond958105
History of this fileTake it
The walk stopped after 200 commits: lines older than 5f5da48 point at it.
globset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 1–13why, one step back1name: ci2on:3 pull_request:4 push:5 branches:6 - master7 schedule:8 - cron: '00 01 * * *'910# The section is needed to drop write-all permissions that are granted on11# `schedule` event. By specifying any permission explicitly all others are set12# to none. By using the principle of least privilege the damage a compromised13# workflow can do (because of an injection or compromised third party tool ordoc: fix typos in commentsPatrick Stöcklebefore adoptionb009b5b
line 14why, one step back14# action) is restricted. Currently the workflow doesn't need any additionalglobset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 15–55why, one step back15# permission except for pulling the code. Adding labels to issues, commenting16# on pull-requests, etc. may need additional permissions:17#18# Syntax for this section:19# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions20#21# Reference for how to assign permissions on a job-by-job basis:22# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs23#24# Reference for available permissions that we can enable if needed:25# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token26permissions:27 # to fetch code (actions/checkout)28 contents: read2930jobs:31 test:32 name: test33 env:34 # For some builds, we use cross to test on 32-bit and big-endian35 # systems.36 CARGO: cargo37 # When CARGO is set to CROSS, this is set to `--target matrix.target`.38 # Note that we only use cross on Linux, so setting a target on a39 # different OS will just use normal cargo.40 TARGET_FLAGS:41 # When CARGO is set to CROSS, TARGET_DIR includes matrix.target.42 TARGET_DIR: ./target43 # Bump this as appropriate. We pin to a version to make sure CI44 # continues to work as cross releases in the past have broken things45 # in subtle ways.46 CROSS_VERSION: v0.2.547 # Emit backtraces on panics.48 RUST_BACKTRACE: 149 runs-on: ${{ matrix.os }}50 strategy:51 fail-fast: false52 matrix:53 include:54 - build: pinned55 os: ubuntu-latestmsrv: bump to Rust 1.96Andrew Gallantbefore adoptionc035d23
line 56why, one step back56 rust: 1.96.0globset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 57–77why, one step back57 - build: stable58 os: ubuntu-latest59 rust: stable60 - build: beta61 os: ubuntu-latest62 rust: beta63 - build: nightly64 os: ubuntu-latest65 rust: nightly66 - build: stable-musl67 os: ubuntu-latest68 rust: stable69 target: x86_64-unknown-linux-musl70 - build: stable-x8671 os: ubuntu-latest72 rust: stable73 target: i686-unknown-linux-gnu74 - build: stable-aarch6475 os: ubuntu-latest76 rust: stable77 target: aarch64-unknown-linux-gnuci: add support for `aarch64-unknown-linux-musl`Andrew Gallantbefore adoption48a6ad9
lines 78–81why, one step back78 - build: stable-aarch64-musl79 os: ubuntu-latest80 rust: stable81 target: aarch64-unknown-linux-muslglobset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 82–101why, one step back82 - build: stable-arm-gnueabihf83 os: ubuntu-latest84 rust: stable85 target: armv7-unknown-linux-gnueabihf86 - build: stable-arm-musleabihf87 os: ubuntu-latest88 rust: stable89 target: armv7-unknown-linux-musleabihf90 - build: stable-arm-musleabi91 os: ubuntu-latest92 rust: stable93 target: armv7-unknown-linux-musleabi94 - build: stable-powerpc6495 os: ubuntu-latest96 rust: stable97 target: powerpc64-unknown-linux-gnu98 - build: stable-s390x99 os: ubuntu-latest100 rust: stable101 target: s390x-unknown-linux-gnurelease: add binaries for `riscv64gc-unknown-linux-gnu` targetmariano-m13before adoption7c2161d
lines 102–105why, one step back102 - build: stable-riscv64103 os: ubuntu-latest104 rust: stable105 target: riscv64gc-unknown-linux-gnuglobset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 106–173why, one step back106 - build: macos107 os: macos-latest108 rust: nightly109 - build: win-msvc110 os: windows-latest111 rust: nightly112 - build: win-gnu113 os: windows-latest114 rust: nightly-x86_64-gnu115 - build: winaarch64-msvc116 os: windows-11-arm117 rust: nightly118 steps:119 - name: Checkout repository120 uses: actions/checkout@v4121122 - name: Install packages (Ubuntu)123 if: matrix.os == 'ubuntu-latest'124 run: |125 ci/ubuntu-install-packages126127 - name: Install Rust128 uses: dtolnay/rust-toolchain@master129 with:130 toolchain: ${{ matrix.rust }}131132 - name: Use Cross133 if: matrix.os == 'ubuntu-latest' && matrix.target != ''134 run: |135 # In the past, new releases of 'cross' have broken CI. So for now, we136 # pin it. We also use their pre-compiled binary releases because cross137 # has over 100 dependencies and takes a bit to compile.138 dir="$RUNNER_TEMP/cross-download"139 mkdir "$dir"140 echo "$dir" >> $GITHUB_PATH141 cd "$dir"142 curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz"143 tar xf cross-x86_64-unknown-linux-musl.tar.gz144 echo "CARGO=cross" >> $GITHUB_ENV145 echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV146 echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV147148 - name: Show command used for Cargo149 run: |150 echo "cargo command is: ${{ env.CARGO }}"151 echo "target flag is: ${{ env.TARGET_FLAGS }}"152 echo "target dir is: ${{ env.TARGET_DIR }}"153154 - name: Build ripgrep and all crates155 run: ${{ env.CARGO }} build --verbose --workspace ${{ env.TARGET_FLAGS }}156157 - name: Build ripgrep with PCRE2158 run: ${{ env.CARGO }} build --verbose --workspace --features pcre2 ${{ env.TARGET_FLAGS }}159160 # This is useful for debugging problems when the expected build artifacts161 # (like shell completions and man pages) aren't generated.162 - name: Show build.rs stderr163 shell: bash164 run: |165 set +x166 stderr="$(find "${{ env.TARGET_DIR }}/debug" -name stderr -print0 | xargs -0 ls -t | head -n1)"167 if [ -s "$stderr" ]; then168 echo "===== $stderr ===== "169 cat "$stderr"170 echo "====="171 fi172 set -x173cargo: add new build-time `unstable-index` featureAndrew Gallantbefore adoptiond958105
lines 174–176why, one step back174 - name: Run tests with indexing enabled175 run: ${{ env.CARGO }} test --verbose --workspace --features unstable-index ${{ env.TARGET_FLAGS }}176globset: support nested alternatesLuke Sandbergbefore adoption5f5da48
lines 177–271why, one step back177 - name: Run tests with PCRE2 (sans cross)178 if: matrix.target == ''179 run: ${{ env.CARGO }} test --verbose --workspace --features pcre2 ${{ env.TARGET_FLAGS }}180181 - name: Run tests without PCRE2 (with cross)182 # These tests should actually work, but they almost double the runtime.183 # Every integration test spins up qemu to run 'rg', and when PCRE2 is184 # enabled, every integration test is run twice: one with the default185 # regex engine and once with PCRE2.186 if: matrix.target != ''187 run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }}188189 - name: Test zsh shell completions (Unix, sans cross)190 # We could test this when using Cross, but we'd have to execute the191 # 'rg' binary (done in test-complete) with qemu, which is a pain and192 # doesn't really gain us much. If shell completion works in one place,193 # it probably works everywhere.194 if: matrix.target == '' && !startsWith(matrix.os, 'windows')195 shell: bash196 run: ci/test-complete197198 - name: Print hostname detected by grep-cli crate199 shell: bash200 run: ${{ env.CARGO }} test --manifest-path crates/cli/Cargo.toml ${{ env.TARGET_FLAGS }} --lib print_hostname -- --nocapture201202 - name: Print available short flags203 shell: bash204 run: ${{ env.CARGO }} test --bin rg ${{ env.TARGET_FLAGS }} flags::defs::tests::available_shorts -- --nocapture205206 # Setup and compile on the wasm32-wasip1 target207 wasm:208 runs-on: ubuntu-latest209 steps:210 - name: Checkout repository211 uses: actions/checkout@v4212 - name: Install Rust213 uses: dtolnay/rust-toolchain@master214 with:215 toolchain: stable216 - name: Add wasm32-wasip1 target217 run: rustup target add wasm32-wasip1218 - name: Basic build219 run: cargo build --verbose220221 rustfmt:222 runs-on: ubuntu-latest223 steps:224 - name: Checkout repository225 uses: actions/checkout@v4226 - name: Install Rust227 uses: dtolnay/rust-toolchain@master228 with:229 toolchain: stable230 components: rustfmt231 - name: Check formatting232 run: cargo fmt --all --check233234 docs:235 runs-on: ubuntu-latest236 steps:237 - name: Checkout repository238 uses: actions/checkout@v4239 - name: Install Rust240 uses: dtolnay/rust-toolchain@master241 with:242 toolchain: stable243 - name: Check documentation244 env:245 RUSTDOCFLAGS: -D warnings246 run: cargo doc --no-deps --document-private-items --workspace247248 fuzz_testing:249 name: Compile Fuzz Test Targets250 runs-on: ubuntu-latest251 steps:252 - name: Checkout repository253 uses: actions/checkout@v4254255 - name: Install required packages (Ubuntu)256 run: |257 sudo apt-get update258 sudo apt-get install g++ --yes259260 - name: Install Rust261 uses: dtolnay/rust-toolchain@master262 with:263 toolchain: stable264265 - name: Install Fuzzer266 run: cargo install cargo-fuzz267 working-directory: fuzz268269 - name: Verify fuzz targets build270 run: cargo check271 working-directory: fuzz