summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 89e631f96fb6d6cd7d8d92fdb0804b807d69ee19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CI

on: [push]

jobs:
  formatting:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust: [stable, beta]
    steps:
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.rust }}
    - uses: actions/checkout@v1
    - name: Install rustfmt
      run: rustup component add rustfmt
    - name: Check code formatting
      run: cargo fmt -- --check

  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: stable
    - uses: actions/checkout@v1
    - name: Install clippy
      run: rustup component add clippy
    - name: Lint (default features)
      run: cargo clippy --all-targets
    - name: Lint (no default features)
      run: cargo clippy --all-targets --no-default-features

  test_linux:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        build:
        - target: x86_64-unknown-linux-gnu
          flags:
          rust: stable
        - target: x86_64-unknown-linux-gnu
          flags:
          rust: beta
        - target: x86_64-unknown-linux-musl
          flags: --no-default-features --features terminology
          rust: stable
    steps:
    # Install ansi2html for tests
    - uses: actions/setup-python@v1
      with:
        python-version: '3.x'
    - name: Install ansi2html for tests
      run: pip install ansi2html
    # Install musl tools for musl target
    - name: Install musl tools
      run: sudo apt-get install musl-tools
    # Setup rust version, and setup the target
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.build.rust }}
    - name: Setup target
      run: rustup target add ${{ matrix.build.target }}
    # Test
    - uses: actions/checkout@v1
    - name: Test
      run: cargo test --target ${{ matrix.build.target }} ${{ matrix.build.flags }}
    - name: Format sample
      run: cargo run --target ${{ matrix.build.target }} ${{ matrix.build.flags }} -- sample/common-mark.md
  test_macos:
    runs-on: macOS-latest
    steps:
    # Install ansi2html for tests
    - uses: actions/setup-python@v1
      with:
        python-version: '3.x'
    - name: Install ansi2html for tests
      run: pip install ansi2html
    # Setup rust version
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: stable
    # Test code
    - uses: actions/checkout@v1
    - name: Test
      run: cargo test --no-default-features --features iterm2,remote_resources
    - name: Format sample
      run: cargo run --no-default-features --features iterm2,remote_resources -- sample/common-mark.md
  test_windows:
    runs-on: windows-latest
    steps:
    # Setup rust version
    - uses: hecrj/setup-rust-action@v1
      with:
        rust-version: stable
    - name: Setup target
      run: rustup target add x86_64-pc-windows-mscv
    # Test code
    - uses: actions/checkout@v1
    - name: Test
      run: cargo test --target x86_64-pc-windows-mscv --no-default-features
    - name: Format sample
      run: cargo run --target x86_64-pc-windows-mscv --no-default-features