| 1 |
name: ci |
| 2 |
on: |
| 3 |
pull_request: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
schedule: |
| 8 |
- cron: '00 01 * * *' |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
permissions: |
| 27 |
|
| 28 |
contents: read |
| 29 |
|
| 30 |
jobs: |
| 31 |
test: |
| 32 |
name: test |
| 33 |
env: |
| 34 |
|
| 35 |
|
| 36 |
CARGO: cargo |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
TARGET: |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
CROSS_VERSION: v0.2.5 |
| 45 |
runs-on: ${{ matrix.os }} |
| 46 |
strategy: |
| 47 |
fail-fast: false |
| 48 |
matrix: |
| 49 |
include: |
| 50 |
- build: pinned |
| 51 |
os: ubuntu-latest |
| 52 |
rust: 1.60.0 |
| 53 |
- build: stable |
| 54 |
os: ubuntu-latest |
| 55 |
rust: stable |
| 56 |
- build: stable-x86 |
| 57 |
os: ubuntu-latest |
| 58 |
rust: stable |
| 59 |
target: i686-unknown-linux-gnu |
| 60 |
- build: stable-aarch64 |
| 61 |
os: ubuntu-latest |
| 62 |
rust: stable |
| 63 |
target: aarch64-unknown-linux-gnu |
| 64 |
- build: stable-powerpc64 |
| 65 |
os: ubuntu-latest |
| 66 |
rust: stable |
| 67 |
target: powerpc64-unknown-linux-gnu |
| 68 |
- build: stable-s390x |
| 69 |
os: ubuntu-latest |
| 70 |
rust: stable |
| 71 |
target: s390x-unknown-linux-gnu |
| 72 |
- build: beta |
| 73 |
os: ubuntu-latest |
| 74 |
rust: beta |
| 75 |
- build: nightly |
| 76 |
os: ubuntu-latest |
| 77 |
rust: nightly |
| 78 |
- build: macos |
| 79 |
os: macos-latest |
| 80 |
rust: stable |
| 81 |
- build: win-msvc |
| 82 |
os: windows-latest |
| 83 |
rust: stable |
| 84 |
- build: win-gnu |
| 85 |
os: windows-latest |
| 86 |
rust: stable-x86_64-gnu |
| 87 |
steps: |
| 88 |
- name: Checkout repository |
| 89 |
uses: actions/checkout@v3 |
| 90 |
- name: Install Rust |
| 91 |
uses: dtolnay/rust-toolchain@master |
| 92 |
with: |
| 93 |
toolchain: ${{ matrix.rust }} |
| 94 |
- name: Install and configure Cross |
| 95 |
if: matrix.os == 'ubuntu-latest' && matrix.target != '' |
| 96 |
run: | |
| 97 |
# In the past, new releases of 'cross' have broken CI. So for now, we |
| 98 |
# pin it. We also use their pre-compiled binary releases because cross |
| 99 |
# has over 100 dependencies and takes a bit to compile. |
| 100 |
dir="$RUNNER_TEMP/cross-download" |
| 101 |
mkdir "$dir" |
| 102 |
echo "$dir" >> $GITHUB_PATH |
| 103 |
cd "$dir" |
| 104 |
curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" |
| 105 |
tar xf cross-x86_64-unknown-linux-musl.tar.gz |
| 106 |
|
| 107 |
# We used to install 'cross' from master, but it kept failing. So now |
| 108 |
# we build from a known-good version until 'cross' becomes more stable |
| 109 |
# or we find an alternative. Notably, between v0.2.1 and current |
| 110 |
# master (2022-06-14), the number of Cross's dependencies has doubled. |
| 111 |
echo "CARGO=cross" >> $GITHUB_ENV |
| 112 |
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV |
| 113 |
- name: Show command used for Cargo |
| 114 |
run: | |
| 115 |
echo "cargo command is: ${{ env.CARGO }}" |
| 116 |
echo "target flag is: ${{ env.TARGET }}" |
| 117 |
- name: Show CPU info for debugging |
| 118 |
if: matrix.os == 'ubuntu-latest' |
| 119 |
run: lscpu |
| 120 |
|
| 121 |
- name: Pin memchr to 2.6.2 |
| 122 |
if: matrix.build == 'pinned' |
| 123 |
run: cargo update -p memchr --precise 2.6.2 |
| 124 |
- run: ${{ env.CARGO }} build --verbose $TARGET |
| 125 |
- run: ${{ env.CARGO }} doc --verbose $TARGET |
| 126 |
- run: ${{ env.CARGO }} test --verbose $TARGET |
| 127 |
- run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std,perf-literal $TARGET |
| 128 |
- run: ${{ env.CARGO }} test --lib --verbose --no-default-features $TARGET |
| 129 |
- run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std $TARGET |
| 130 |
- run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features perf-literal $TARGET |
| 131 |
- run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std,perf-literal,logging $TARGET |
| 132 |
- if: matrix.build == 'nightly' |
| 133 |
run: ${{ env.CARGO }} build --manifest-path aho-corasick-debug/Cargo.toml $TARGET |
| 134 |
|
| 135 |
rustfmt: |
| 136 |
name: rustfmt |
| 137 |
runs-on: ubuntu-latest |
| 138 |
steps: |
| 139 |
- name: Checkout repository |
| 140 |
uses: actions/checkout@v3 |
| 141 |
- name: Install Rust |
| 142 |
uses: dtolnay/rust-toolchain@master |
| 143 |
with: |
| 144 |
toolchain: stable |
| 145 |
components: rustfmt |
| 146 |
- name: Check formatting |
| 147 |
run: | |
| 148 |
cargo fmt --all -- --check |