summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 9dbec6fab522787d1ad787bee3329b5c5a4f91f5 (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
105
106
107
name: ci
on:
  pull_request:
    branches:
      - develop
      - main
      - master
  push:
    branches:
      - develop
      - main
      - master
  schedule:
    - cron: "0 9 * * *"

env:
  RUST_BACKTRACE: full
  NO_COLOR: 1

jobs:
  test:
    name: Test Rust ${{ matrix.name }} on ${{ matrix.target }}
    runs-on: ${{ matrix.runner }}
    continue-on-error: ${{ matrix.experimental }}
    strategy:
      matrix:
        include:
          - name: linux-amd64
            runner: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            experimental: false
            toolchain: stable
          - name: win-amd64
            runner: windows-latest
            target: x86_64-pc-windows-msvc
            experimental: false
            toolchain: stable
          - name: macos-amd64
            runner: macos-latest
            target: x86_64-apple-darwin
            experimental: false
            toolchain: stable
          - name: macos-arm64
            runner: macos-latest
            target: aarch64-apple-darwin
            experimental: false
            toolchain: stable
          - name: linux-amd64
            runner: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            experimental: true
            toolchain: beta
          - name: linux-amd64
            runner: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            experimental: true
            toolchain: nightly
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Rust toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "${{ matrix.toolchain }}"
          targets: "${{ matrix.target }}"
      - run: cargo build --verbose --all
      - run: cargo build --release
      - run: cargo test --verbose --all -- --nocapture
      - run: cargo install hyperfine
      - run: echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | target/release/hx
      - run: hyperfine -i --warmup 20 "echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' | target/release/hx"
      # - run: cargo test --verbose --workspace --all-features
      # - run: cargo test --verbose --workspace --no-default-features
      # see https://github.com/actions/upload-release-asset

  clippy:
    name: Lint with clippy
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy
      - run: cargo clippy --workspace --all-targets --verbose
      - run: cargo clippy --workspace --all-targets --verbose --no-default-features
      - run: cargo clippy --workspace --all-targets --verbose --all-features

  rustfmt:
    name: Verify code formatting
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - run: cargo fmt --all -- --check

  codespell:
    name: Verify code spelling
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: |
          pip install codespell
          codespell -L crate