name: "Test & Lint"
on:
push:
tags_ignore: '*'
pull_request:
jobs:
check-scripts:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Download tools
run: |
curl -fsSL -o ./shfmt https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64
chmod 700 ./shfmt
- name: Check formatting
run: ./shfmt -i 4 -l -d scripts/*
- name: Lint scripts
run: shellcheck -S style -o all scripts/*
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: rustfmt --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
manpage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
- name: install asciidoctor
run: gem install asciidoctor
- name: build manpage
run: asciidoctor -b manpage -a reproducible mdcat.1.adoc
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
rust: [stable, beta]
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
flags: --no-default-features
- target: x86_64-apple-darwin
os: macOS-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
exclude:
- target: x86_64-unknown-linux-musl
rust: beta
- target: x86_64-apple-darwin
rust: beta
- target: x86_64-pc-windows-msvc
rust: beta
steps:
- uses: actions/checkout@v2
- name: Install musl tools
run: sudo apt-get install musl-tools
if: "contains(matrix.target, 'musl')"
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
target: ${{ matrix.target }}
components: clippy
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --locked --target ${{ matrix.target }} ${{ matrix.flags }}
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --locked --target ${{ matrix.target }} ${{ matrix.flags }}
name: clippy-${{ matrix.rust}}-${{ matrix.target }}
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --locked --target ${{ matrix.target }} ${{ matrix.flags }}
- name: Format sample
uses: actions-rs/cargo@v1
with:
command: run
args: --target ${{ matrix.target }} ${{ matrix.flags }} -- sample/common-mark.md