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    runs-on: ${{ matrix.os }}
13    strategy:
14      matrix:
15        build:
16        - pinned
17        - pinned-win
18        - stable
19        - beta
20        - nightly
21        - macos
22        - win-msvc
23        - win-gnu
24        include:
25        - build: pinned
26          os: ubuntu-18.04
27          rust: 1.34.0
28        - build: pinned-win
29          os: windows-2019
30          rust: 1.34.0
31        - build: stable
32          os: ubuntu-18.04
33          rust: stable
34        - build: beta
35          os: ubuntu-18.04
36          rust: beta
37        - build: nightly
38          os: ubuntu-18.04
39          rust: nightly
40        - build: macos
41          os: macos-latest
42          rust: stable
43        - build: win-msvc
44          os: windows-2019
45          rust: stable
46        - build: win-gnu
47          os: windows-2019
48          rust: stable-x86_64-gnu
49    steps:
50    - name: Checkout repository
51      uses: actions/checkout@v1
52      with:
53        fetch-depth: 1
54    - name: Install Rust
55      uses: actions-rs/toolchain@v1
56      with:
57        toolchain: ${{ matrix.rust }}
58        override: true
59        profile: minimal
60    - run: cargo build --verbose
61    - run: cargo doc --verbose
62    - if: startsWith(matrix.build, 'pinned-') == false
63      run: cargo test --verbose
64    - if: matrix.build == 'nightly'
65      run: |
66        set -x
67        cargo generate-lockfile -Z minimal-versions
68        cargo build --verbose
69        cargo test --verbose
70
71  rustfmt:
72    name: rustfmt
73    runs-on: ubuntu-18.04
74    steps:
75    - name: Checkout repository
76      uses: actions/checkout@v1
77      with:
78        fetch-depth: 1
79    - name: Install Rust
80      uses: actions-rs/toolchain@v1
81      with:
82        toolchain: stable
83        profile: minimal
84        components: rustfmt
85    - name: Install rustfmt
86      run: rustup component add rustfmt
87    - name: Check formatting
88      run: |
89        cargo fmt --all -- --check
90