File: CI.yml

package info (click to toggle)
rust-syntect 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,956 kB
  • sloc: makefile: 2
file content (122 lines) | stat: -rw-r--r-- 4,089 bytes parent folder | download | duplicates (2)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CI

on:
  workflow_call: # From .github/workflows/Release.yml
  workflow_dispatch:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  CARGO_TERM_COLOR: always

jobs:
  min_version:
    name: Minimum supported rust version
    runs-on: ubuntu-24.04
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@master
      with:
        toolchain: stable minus 2 releases # MSRV policy = last three versions of stable
        components: clippy, rustfmt

    - name: Run cargo fmt --check
      run: cargo fmt -- --check

    - name: Run cargo clippy
      run: |
        # Must run before `cargo check` until we use Rust 1.52
        # See https://github.com/rust-lang/rust-clippy/issues/4612
        cargo clippy --all-targets --all-features -- \
          --allow clippy::unknown_clippy_lints \
          --allow clippy::unnecessary_cast \
          --allow clippy::block_in_if_condition_stmt
        # Prevent regressions of https://github.com/trishume/syntect/issues/98
        cargo clippy --all-features --lib -- --deny clippy::panic
    - name: Run cargo check
      run: |
        cargo check --all-features --all-targets
        # Check that if some other crate in the downstream dependency tree
        # enables serde's "derive" feature, syntect still builds.
        cargo check --all-features --features serde/derive

  documentation:
    name: Documentation checks
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - run: RUSTDOCFLAGS='--deny warnings' cargo doc --no-deps --document-private-items --all-features

  bat-tests:
    name: Run bat syntax regression tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        path: 'syntect'
    - uses: actions/checkout@v4
      with:
        repository: 'sharkdp/bat'
        path: 'bat'
        ref: master
        submodules: true
    - name: bat/tests/syntax-tests/regression_test.sh
      run: |
        cd bat
        sed -i 's%\[dependencies.syntect\]%[dependencies.syntect]\npath = "../syntect"%' Cargo.toml
        cargo build --release # Build bat so we can update the assets
        PATH=target/release:$PATH ./assets/create.sh # Update assets with newly built bat
        cargo build --release # Build bat using the newly updated assets
        PATH=./target/release:$PATH tests/syntax-tests/regression_test.sh

  build-and-test:
    name: Build and test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
      with:
        submodules: true
    - uses: dtolnay/rust-toolchain@stable
    - name: Build
      run: |
        cargo build
    - name: Run tests
      run: |
        cargo test --features metadata
    - name: Run tests with fancy
      run: |
        # Run these tests in release mode since they're slow as heck otherwise
        cargo test --features default-fancy --no-default-features --release
    - name: Ensure highlight works without 'plist-load' and 'yaml-load' features
      run: |
        cargo run --example synhtml --no-default-features --features html,default-syntaxes,default-themes,regex-onig -- examples/synhtml.rs
    - name: Run tests with 'default-syntaxes' but without 'default-themes'
      run: |
        cargo test --lib --example synstats --no-default-features --features default-syntaxes,yaml-load,regex-onig
    - name: Run tests without default features
      run: |
        cargo test --lib --no-default-features
    - name: make stuff
      run: |
        make assets
        make syntest
        make syntest-fancy
    - name: Docs
      run: |
        cargo doc

  check-feature-powerset:
    name: Check feature powerset
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
    - uses: taiki-e/install-action@v2
      with:
        tool: cargo-hack
    # Ensure that `cargo check` works across many different feature sets
    - name: Check feature powerset
      run: |
        cargo hack --feature-powerset --depth=2 --features=regex-fancy --exclude-features=regex-onig check