Debian Codegraph @

debian/rust-vendor/aho-corasick/.github/workflows/ci.yml

raw
1 name: ci
2 on:
3 pull_request:
4 push:
5 branches:
6 - master
7 schedule:
8 - cron: '00 01 * * *'
9
10 # The section is needed to drop write-all permissions that are granted on
11 # `schedule` event. By specifying any permission explicitly all others are set
12 # to none. By using the principle of least privilege the damage a compromised
13 # workflow can do (because of an injection or compromised third party tool or
14 # action) is restricted. Currently the worklow doesn't need any additional
15 # permission except for pulling the code. Adding labels to issues, commenting
16 # on pull-requests, etc. may need additional permissions:
17 #
18 # Syntax for this section:
19 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
20 #
21 # Reference for how to assign permissions on a job-by-job basis:
22 # https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
23 #
24 # Reference for available permissions that we can enable if needed:
25 # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
26 permissions:
27 # to fetch code (actions/checkout)
28 contents: read
29
30 jobs:
31 test:
32 name: test
33 env:
34 # For some builds, we use cross to test on 32-bit and big-endian
35 # systems.
36 CARGO: cargo
37 # When CARGO is set to CROSS, TARGET is set to `--target matrix.target`.
38 # Note that we only use cross on Linux, so setting a target on a
39 # different OS will just use normal cargo.
40 TARGET:
41 # Bump this as appropriate. We pin to a version to make sure CI
42 # continues to work as cross releases in the past have broken things
43 # in subtle ways.
44 CROSS_VERSION: v0.2.5
45 runs-on: ${{ matrix.os }}
46 strategy:
47 fail-fast: false
48 matrix:
49 include:
50 - build: pinned
51 os: ubuntu-latest
52 rust: 1.60.0
53 - build: stable
54 os: ubuntu-latest
55 rust: stable
56 - build: stable-x86
57 os: ubuntu-latest
58 rust: stable
59 target: i686-unknown-linux-gnu
60 - build: stable-aarch64
61 os: ubuntu-latest
62 rust: stable
63 target: aarch64-unknown-linux-gnu
64 - build: stable-powerpc64
65 os: ubuntu-latest
66 rust: stable
67 target: powerpc64-unknown-linux-gnu
68 - build: stable-s390x
69 os: ubuntu-latest
70 rust: stable
71 target: s390x-unknown-linux-gnu
72 - build: beta
73 os: ubuntu-latest
74 rust: beta
75 - build: nightly
76 os: ubuntu-latest
77 rust: nightly
78 - build: macos
79 os: macos-latest
80 rust: stable
81 - build: win-msvc
82 os: windows-latest
83 rust: stable
84 - build: win-gnu
85 os: windows-latest
86 rust: stable-x86_64-gnu
87 steps:
88 - name: Checkout repository
89 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
90 with:
91 persist-credentials: false
92 - name: Install Rust
93 uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
94 with:
95 toolchain: ${{ matrix.rust }}
96 - name: Install and configure Cross
97 if: matrix.os == 'ubuntu-latest' && matrix.target != ''
98 run: |
99 # In the past, new releases of 'cross' have broken CI. So for now, we
100 # pin it. We also use their pre-compiled binary releases because cross
101 # has over 100 dependencies and takes a bit to compile.
102 dir="$RUNNER_TEMP/cross-download"
103 mkdir "$dir"
104 echo "$dir" >> $GITHUB_PATH
105 cd "$dir"
106 curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz"
107 tar xf cross-x86_64-unknown-linux-musl.tar.gz
108
109 # We used to install 'cross' from master, but it kept failing. So now
110 # we build from a known-good version until 'cross' becomes more stable
111 # or we find an alternative. Notably, between v0.2.1 and current
112 # master (2022-06-14), the number of Cross's dependencies has doubled.
113 echo "CARGO=cross" >> $GITHUB_ENV
114 echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
115 - name: Show command used for Cargo
116 run: |
117 echo "cargo command is: ${{ env.CARGO }}"
118 echo "target flag is: ${{ env.TARGET }}"
119 - name: Show CPU info for debugging
120 if: matrix.os == 'ubuntu-latest'
121 run: lscpu
122 # See: https://github.com/rust-lang/regex/blob/a2887636930156023172e4b376a6febad4e49120/.github/workflows/ci.yml#L145-L163
123 - name: Pin memchr to 2.6.2
124 if: matrix.build == 'pinned'
125 run: |
126 cargo update -p memchr --precise 2.6.2
127 cargo update -p log --precise 0.4.20
128 - run: ${{ env.CARGO }} build --verbose $TARGET
129 - run: ${{ env.CARGO }} doc --verbose $TARGET
130 - run: ${{ env.CARGO }} test --verbose $TARGET
131 - run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std,perf-literal $TARGET
132 - run: ${{ env.CARGO }} test --lib --verbose --no-default-features $TARGET
133 - run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std $TARGET
134 - run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features perf-literal $TARGET
135 - run: ${{ env.CARGO }} test --lib --verbose --no-default-features --features std,perf-literal,logging $TARGET
136 - if: matrix.build == 'nightly'
137 run: ${{ env.CARGO }} build --manifest-path aho-corasick-debug/Cargo.toml $TARGET
138
139 rustfmt:
140 name: rustfmt
141 runs-on: ubuntu-latest
142 steps:
143 - name: Checkout repository
144 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
145 with:
146 persist-credentials: false
147 - name: Install Rust
148 uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
149 with:
150 toolchain: stable
151 components: rustfmt
152 - name: Check formatting
153 run: |
154 cargo fmt --all -- --check