• 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        - stable-thumb
27        - beta
28        - nightly
29        - macos
30        - win-msvc
31        - win-gnu
32        include:
33        - build: pinned
34          os: ubuntu-18.04
35          rust: 1.41.1
36        - build: stable
37          os: ubuntu-18.04
38          rust: stable
39        - build: stable-32
40          os: ubuntu-18.04
41          rust: stable
42          target: i686-unknown-linux-gnu
43        - build: stable-mips
44          os: ubuntu-18.04
45          rust: stable
46          target: mips64-unknown-linux-gnuabi64
47        - build: stable-thumb
48          os: ubuntu-18.04
49          rust: stable
50          target: thumbv7em-none-eabihf
51        - build: beta
52          os: ubuntu-18.04
53          rust: beta
54        - build: nightly
55          os: ubuntu-18.04
56          rust: nightly
57        - build: macos
58          os: macos-latest
59          rust: stable
60        - build: win-msvc
61          os: windows-2019
62          rust: stable
63        - build: win-gnu
64          os: windows-2019
65          rust: stable-x86_64-gnu
66    steps:
67    - name: Checkout repository
68      uses: actions/checkout@v1
69      with:
70        fetch-depth: 1
71
72    - name: Install Rust
73      uses: actions-rs/toolchain@v1
74      with:
75        toolchain: ${{ matrix.rust }}
76        profile: minimal
77        override: true
78
79    - name: Use Cross
80      if: matrix.target != ''
81      run: |
82        # FIXME: to work around bugs in latest cross release, install master.
83        # See: https://github.com/rust-embedded/cross/issues/357
84        cargo install --git https://github.com/rust-embedded/cross
85        echo "CARGO=cross" >> $GITHUB_ENV
86        echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
87
88    - name: Show command used for Cargo
89      run: |
90        echo "cargo command is: ${{ env.CARGO }}"
91        echo "target flag is: ${{ env.TARGET }}"
92
93    - name: Build
94      if: matrix.build != 'stable-thumb'
95      run: ${{ env.CARGO }} build --verbose ${{ env.TARGET }}
96
97    - name: Build docs
98      if: matrix.build != 'stable-thumb'
99      run: ${{ env.CARGO }} doc --verbose ${{ env.TARGET }}
100
101    # Our dev dependencies are increasing their MSRV more quickly then we want
102    # to, so the following are only run on non-pinned targets.
103
104    - name: Build examples
105      if: matrix.build != 'pinned' && matrix.build != 'stable-thumb'
106      run: ${{ env.CARGO }} build --manifest-path examples/Cargo.toml --examples
107
108    - name: Run tests
109      if: matrix.build != 'pinned' && matrix.build != 'stable-thumb' && matrix.build != 'stable-mips'
110      run: ${{ env.CARGO }} test --verbose --features transducer ${{ env.TARGET }}
111
112    # The mips test runner is quite sluggish, so don't run the full test
113    # suite there. Unfortunate, but CI times balloon otherwise.
114    - name: Run tests
115      if: matrix.build == 'stable-mips'
116      run: ${{ env.CARGO }} test --verbose --features transducer --lib ${{ env.TARGET }}
117
118    - name: Build without default features
119      if: matrix.build != 'pinned'
120      run: ${{ env.CARGO }} build --verbose --no-default-features ${{ env.TARGET }}
121
122    - name: Build docs without default features
123      if: matrix.build != 'pinned'
124      run: ${{ env.CARGO }} doc --verbose --lib --no-default-features ${{ env.TARGET }}
125
126    - name: Run tests without default features
127      if: matrix.build != 'pinned' && matrix.build != 'stable-thumb'
128      run: ${{ env.CARGO }} test --verbose --lib --no-default-features ${{ env.TARGET }}
129
130    - name: Compile debug tool
131      if: matrix.build != 'pinned' && matrix.build != 'stable-thumb'
132      run: ${{ env.CARGO }} build --verbose --manifest-path regex-automata-debug/Cargo.toml ${{ env.TARGET }}
133
134    - name: Test benchmarks
135      if: matrix.build != 'pinned' && matrix.build != 'stable-thumb'
136      run: ${{ env.CARGO }} bench --manifest-path bench/Cargo.toml --verbose ${{ env.TARGET }} -- --test
137
138  rustfmt:
139    name: rustfmt
140    runs-on: ubuntu-18.04
141    steps:
142    - name: Checkout repository
143      uses: actions/checkout@v1
144      with:
145        fetch-depth: 1
146    - name: Install Rust
147      uses: actions-rs/toolchain@v1
148      with:
149        toolchain: stable
150        override: true
151        profile: minimal
152        components: rustfmt
153    - name: Check formatting
154      run: |
155        cargo fmt --all -- --check
156    - name: Check formatting for debug tool
157      run: |
158        cargo fmt --manifest-path regex-automata-debug/Cargo.toml -- --check
159