diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c5a67e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CI + +on: + schedule: + - cron: '0 0 * * 6' + push: + branches: + - '*' + pull_request: + +jobs: + rustfmt: + strategy: + fail-fast: false + matrix: + toolchain: + - 1.42.0-x86_64-unknown-linux-gnu + - stable-x86_64-unknown-linux-gnu + + name: Rustfmt (${{ matrix.toolchain }}) + runs-on: ubuntu-18.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: 'Setup `${{ matrix.toolchain }}`' + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + profile: minimal + components: rustfmt + + - name: cargo-fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + build: + strategy: + fail-fast: false + matrix: + toolchain: + - 1.42.0-x86_64-pc-windows-msvc + - 1.42.0-x86_64-apple-darwin + - 1.42.0-x86_64-unknown-linux-gnu + - stable-x86_64-pc-windows-msvc + - stable-x86_64-apple-darwin + - stable-x86_64-unknown-linux-gnu + include: + - { toolchain: 1.42.0-x86_64-pc-windows-msvc , os: windows-2019 } + - { toolchain: 1.42.0-x86_64-apple-darwin , os: macos-10.15 } + - { toolchain: 1.42.0-x86_64-unknown-linux-gnu, os: ubuntu-18.04 } + - { toolchain: stable-x86_64-pc-windows-msvc , os: windows-2019 } + - { toolchain: stable-x86_64-apple-darwin , os: macos-10.15 } + - { toolchain: stable-x86_64-unknown-linux-gnu, os: ubuntu-18.04 } + + name: Build (${{ matrix.toolchain }}) + runs-on: ${{ matrix.os }} + + steps: + - name: Disable `core.autocrlf` + run: git config --global core.autocrlf false + if: matrix.os == 'windows-2019' + + - name: Checkout + uses: actions/checkout@v2 + + - name: 'Setup `${{ matrix.toolchain }}`' + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + profile: minimal + components: clippy + + - name: cargo-clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --all-targets -- -D warnings + + - name: cargo-build + uses: actions-rs/cargo@v1 + with: + command: build + args: --workspace --all-targets + + - name: cargo-test + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace --no-fail-fast + env: + RUST_BACKTRACE: full