• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: ci
2on:
3  pull_request:
4  push:
5    branches:
6    - master
7  schedule:
8  - cron: '00 01 * * *'
9jobs:
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.41.1
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    - name: Checkout repository
63      uses: actions/checkout@v1
64      with:
65        fetch-depth: 1
66    - name: Install Rust
67      uses: dtolnay/rust-toolchain@master
68      with:
69        toolchain: ${{ matrix.rust }}
70    - name: Use Cross
71      if: matrix.target != ''
72      run: |
73        # We used to install 'cross' from master, but it kept failing. So now
74        # we build from a known-good version until 'cross' becomes more stable
75        # or we find an alternative. Notably, between v0.2.1 and current
76        # master (2022-06-14), the number of Cross's dependencies has doubled.
77        cargo install --bins --git https://github.com/rust-embedded/cross --tag v0.2.1
78        echo "CARGO=cross" >> $GITHUB_ENV
79        echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
80    - name: Show command used for Cargo
81      run: |
82        echo "cargo command is: ${{ env.CARGO }}"
83        echo "target flag is: ${{ env.TARGET }}"
84    - name: Show CPU info for debugging
85      if: matrix.os == 'ubuntu-18.04'
86      run: lscpu
87    - run: ${{ env.CARGO }} build --verbose
88    - run: ${{ env.CARGO }} doc --verbose
89    - run: ${{ env.CARGO }} test --verbose
90    - if: matrix.build == 'nightly'
91      run: ${{ env.CARGO }} build --manifest-path aho-corasick-debug/Cargo.toml
92    - if: matrix.build == 'nightly'
93      run: ${{ env.CARGO }} bench --verbose --manifest-path bench/Cargo.toml -- --test
94
95  rustfmt:
96    name: rustfmt
97    runs-on: ubuntu-18.04
98    steps:
99    - name: Checkout repository
100      uses: actions/checkout@v1
101      with:
102        fetch-depth: 1
103    - name: Install Rust
104      uses: dtolnay/rust-toolchain@master
105      with:
106        toolchain: stable
107        components: rustfmt
108    - name: Check formatting
109      run: |
110        cargo fmt --all -- --check
111