|
| 1 | +name: ci |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + schedule: |
| 8 | + - cron: '00 01 * * *' |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: test |
| 12 | + env: |
| 13 | + # For some builds, we use cross to test on 32-bit and big-endian |
| 14 | + # systems. |
| 15 | + CARGO: cargo |
| 16 | + # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`. |
| 17 | + TARGET: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + build: |
| 22 | + - pinned |
| 23 | + - stable |
| 24 | + - stable-32 |
| 25 | + - stable-mips |
| 26 | + - beta |
| 27 | + - nightly |
| 28 | + - macos |
| 29 | + - win-msvc |
| 30 | + - win-gnu |
| 31 | + include: |
| 32 | + - build: pinned |
| 33 | + os: ubuntu-18.04 |
| 34 | + rust: 1.28.0 |
| 35 | + - build: stable |
| 36 | + os: ubuntu-18.04 |
| 37 | + rust: stable |
| 38 | + - build: stable-32 |
| 39 | + os: ubuntu-18.04 |
| 40 | + rust: stable |
| 41 | + target: i686-unknown-linux-gnu |
| 42 | + - build: stable-mips |
| 43 | + os: ubuntu-18.04 |
| 44 | + rust: stable |
| 45 | + target: mips64-unknown-linux-gnuabi64 |
| 46 | + - build: beta |
| 47 | + os: ubuntu-18.04 |
| 48 | + rust: beta |
| 49 | + - build: nightly |
| 50 | + os: ubuntu-18.04 |
| 51 | + rust: nightly |
| 52 | + - build: macos |
| 53 | + os: macos-latest |
| 54 | + rust: stable |
| 55 | + - build: win-msvc |
| 56 | + os: windows-2019 |
| 57 | + rust: stable |
| 58 | + - build: win-gnu |
| 59 | + os: windows-2019 |
| 60 | + rust: stable-x86_64-gnu |
| 61 | + steps: |
| 62 | + |
| 63 | + - name: Checkout repository |
| 64 | + uses: actions/checkout@v1 |
| 65 | + with: |
| 66 | + fetch-depth: 1 |
| 67 | + |
| 68 | + - name: Install Rust |
| 69 | + uses: actions-rs/toolchain@v1 |
| 70 | + with: |
| 71 | + toolchain: ${{ matrix.rust }} |
| 72 | + profile: minimal |
| 73 | + override: true |
| 74 | + |
| 75 | + - name: Install and configure Cross |
| 76 | + if: matrix.target != '' |
| 77 | + run: | |
| 78 | + # FIXME: to work around bugs in latest cross release, install master. |
| 79 | + # See: https://github.com/rust-embedded/cross/issues/357 |
| 80 | + cargo install --git https://github.com/rust-embedded/cross |
| 81 | + echo "::set-env name=CARGO::cross" |
| 82 | + echo "::set-env name=TARGET::--target ${{ matrix.target }}" |
| 83 | +
|
| 84 | + - name: Show command used for Cargo |
| 85 | + run: | |
| 86 | + echo "cargo command is: ${{ env.CARGO }}" |
| 87 | + echo "target flag is: ${{ env.TARGET }}" |
| 88 | +
|
| 89 | + - name: Show CPU info for debugging |
| 90 | + if: matrix.os == 'ubuntu-18.04' |
| 91 | + run: lscpu |
| 92 | + |
| 93 | + - name: Basic build |
| 94 | + run: ${{ env.CARGO }} build --verbose $TARGET |
| 95 | + |
| 96 | + - name: Build docs |
| 97 | + run: ${{ env.CARGO }} doc --verbose $TARGET |
| 98 | + |
| 99 | + # Our dev dependencies evolve more rapidly than we'd like, so only run |
| 100 | + # tests when we aren't pinning the Rust version. |
| 101 | + # |
| 102 | + # Also, our "full" test suite does quite a lot of work, so we only run it |
| 103 | + # on one build. Otherwise, we just run the "default" set of tests. |
| 104 | + - name: Run subset of tests |
| 105 | + if: matrix.build != 'pinned' && matrix.build != 'stable' |
| 106 | + run: ${{ env.CARGO }} test --verbose --test default $TARGET |
| 107 | + |
| 108 | + - name: Run full test suite |
| 109 | + if: matrix.build == 'stable' |
| 110 | + # 'stable' is Linux only, so we have bash. |
| 111 | + run: ./test |
| 112 | + |
| 113 | + - name: Run randomized tests against regexes from the wild |
| 114 | + if: matrix.build == 'stable' |
| 115 | + run: | |
| 116 | + # We run the tests in release mode since it winds up being faster. |
| 117 | + RUST_REGEX_RANDOM_TEST=1 ${{ env.CARGO }} test --release --verbose --test crates-regex $TARGET |
| 118 | +
|
| 119 | + - name: Build regex-syntax docs |
| 120 | + if: matrix.build != 'pinned' |
| 121 | + run: | |
| 122 | + ${{ env.CARGO }} doc --verbose --manifest-path regex-syntax/Cargo.toml $TARGET |
| 123 | +
|
| 124 | + - name: Run subset of regex-syntax tests |
| 125 | + if: matrix.build != 'pinned' && matrix.build != 'stable' |
| 126 | + run: | |
| 127 | + ${{ env.CARGO }} test --verbose --manifest-path regex-syntax/Cargo.toml $TARGET |
| 128 | +
|
| 129 | + - name: Run full regex-syntax test suite |
| 130 | + if: matrix.build == 'stable' |
| 131 | + run: | |
| 132 | + # 'stable' is Linux only, so we have bash. |
| 133 | + cd regex-syntax |
| 134 | + ./test |
| 135 | +
|
| 136 | + - name: Run regex-capi tests |
| 137 | + if: matrix.build == 'stable' |
| 138 | + run: | |
| 139 | + # 'stable' is Linux only, so we have bash. |
| 140 | + cd regex-capi |
| 141 | + ./test |
| 142 | +
|
| 143 | + - if: matrix.build == 'nightly' |
| 144 | + name: Compile regex-debug |
| 145 | + run: | |
| 146 | + ${{ env.CARGO }} build --verbose --manifest-path regex-debug/Cargo.toml $TARGET |
| 147 | +
|
| 148 | + - if: matrix.build == 'nightly' |
| 149 | + name: Run benchmarks as tests |
| 150 | + run: | |
| 151 | + cd bench |
| 152 | + ./run rust --no-run --verbose |
| 153 | +
|
| 154 | + rustfmt: |
| 155 | + name: rustfmt |
| 156 | + runs-on: ubuntu-18.04 |
| 157 | + steps: |
| 158 | + - name: Checkout repository |
| 159 | + uses: actions/checkout@v1 |
| 160 | + with: |
| 161 | + fetch-depth: 1 |
| 162 | + - name: Install Rust |
| 163 | + uses: actions-rs/toolchain@v1 |
| 164 | + with: |
| 165 | + toolchain: stable |
| 166 | + profile: minimal |
| 167 | + override: true |
| 168 | + components: rustfmt |
| 169 | + - name: Install rustfmt |
| 170 | + run: rustup component add rustfmt |
| 171 | + - name: Check formatting |
| 172 | + run: | |
| 173 | + cargo fmt --all -- --check |
0 commit comments