@@ -14,6 +14,8 @@ defaults:
1414jobs :
1515 test :
1616 name : Test ${{ matrix.os }} (${{ matrix.simd_mode }})
17+ permissions :
18+ contents : read
1719 runs-on : ${{ matrix.os }}
1820 strategy :
1921 fail-fast : false
@@ -23,50 +25,56 @@ jobs:
2325 env :
2426 FASTPFOR_SIMD_MODE : ${{ matrix.simd_mode }}
2527 steps :
26- - uses : actions/checkout@v6
27- with : { submodules: recursive }
28+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
29+ with : { persist-credentials: false, submodules: recursive }
2830 - if : github.event_name != 'release' && github.event_name != 'workflow_dispatch'
29- uses : Swatinem/rust-cache@v2
31+ uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
3032 with :
3133 prefix-key : " v0-${{ matrix.simd_mode }}"
32- - uses : taiki-e/install-action@v2
34+ - uses : taiki-e/install-action@56545b37b57562edd73171cb6c62cc509db4c34e # v2.81.7
3335 with : { tool: 'just,cargo-binstall' }
3436 - run : just ci-test
3537
3638 test-nightly :
3739 name : Nightly-specific tests
40+ permissions :
41+ contents : read
3842 runs-on : ubuntu-latest
3943 steps :
40- - uses : actions/checkout@v6
41- with : { submodules: recursive }
44+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
45+ with : { persist-credentials: false, submodules: recursive }
4246 - if : github.event_name != 'release' && github.event_name != 'workflow_dispatch'
43- uses : Swatinem/rust-cache@v2
44- - uses : taiki-e/install-action@v2
47+ uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
48+ - uses : taiki-e/install-action@56545b37b57562edd73171cb6c62cc509db4c34e # v2.81.7
4549 with : { tool: 'just' }
4650 - run : rustup install nightly --profile minimal
4751 - run : just test-publish
4852
4953 test-msrv :
5054 name : Test MSRV
55+ permissions :
56+ contents : read
5157 runs-on : ubuntu-latest
5258 steps :
53- - uses : actions/checkout@v6
54- with : { submodules: recursive }
59+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
60+ with : { persist-credentials: false, submodules: recursive }
5561 - if : github.event_name != 'release' && github.event_name != 'workflow_dispatch'
56- uses : Swatinem/rust-cache@v2
57- - uses : taiki-e/install-action@v2
62+ uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
63+ - uses : taiki-e/install-action@56545b37b57562edd73171cb6c62cc509db4c34e # v2.81.7
5864 with : { tool: 'just' }
5965 - name : Read MSRV
6066 id : msrv
6167 run : echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
6268 - name : Install MSRV Rust ${{ steps.msrv.outputs.value }}
63- uses : dtolnay/rust-toolchain@stable
69+ uses : dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
6470 with :
6571 toolchain : ${{ steps.msrv.outputs.value }}
6672 - run : just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV
6773
6874 fuzz :
6975 name : Fuzz
76+ permissions :
77+ contents : read
7078 runs-on : ubuntu-latest
7179 env :
7280 # The number of seconds to run the fuzz target.
@@ -79,48 +87,50 @@ jobs:
7987 - fuzz_target : decode_oracle
8088 - fuzz_target : decode_arbitrary
8189 steps :
82- - uses : actions/checkout@v6
83- with : {persist-credentials: false, submodules: recursive}
90+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
91+ with : { persist-credentials: false, submodules: recursive }
8492 # Install the nightly Rust channel.
8593 - run : rustup toolchain install nightly
8694 - run : rustup default nightly
8795 # Install and cache `cargo-fuzz`.
88- - uses : taiki-e/install-action@v2
89- with :
90- tool : cargo-binstall
96+ - uses : taiki-e/install-action@56545b37b57562edd73171cb6c62cc509db4c34e # v2.81.7
97+ with : { tool: 'cargo-binstall' }
9198 - run : cargo binstall -y cargo-fuzz@0.13.1 # Pinned to avoid breakage.
9299 # Build and then run the fuzz target.
93100 # --target x86_64-unknown-linux-gnu is necessary to not default to musl, which is not supported by cargo-fuzz.
94101 - run : cargo fuzz build --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }}
95102 - run : cargo fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
96103 # Upload fuzzing artifacts on failure for post-mortem debugging.
97- - uses : actions/upload-artifact@v7
104+ - uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
98105 if : failure()
99106 with :
100107 name : fuzzing-artifacts-${{ matrix.fuzz_target }}-${{ github.sha }}
101108 path : fuzz/artifacts
102109
103110 coverage :
104111 name : Code Coverage
112+ permissions :
113+ contents : read
105114 if : github.event_name != 'release'
106115 runs-on : ubuntu-latest
107116 steps :
108- - uses : actions/checkout@v6
109- with : { submodules: recursive }
110- - uses : Swatinem/rust-cache@v2
111- - uses : taiki-e/install-action@v2
117+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
118+ with : { persist-credentials: false, submodules: recursive }
119+ - uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
120+ - uses : taiki-e/install-action@56545b37b57562edd73171cb6c62cc509db4c34e # v2.81.7
112121 with : { tool: 'just,cargo-llvm-cov' }
113122 - name : Generate code coverage
114123 run : just ci-coverage
115124 - name : Upload coverage to Codecov
116- uses : codecov/codecov-action@v6
125+ uses : codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
117126 with :
118127 token : ${{ secrets.CODECOV_TOKEN }}
119128 files : target/llvm-cov/codecov.info
120129
121130 # This job checks if any of the previous jobs failed or were canceled.
122131 # This approach also allows some jobs to be skipped if they are not needed.
123132 ci-passed :
133+ permissions : {}
124134 needs : [ test, test-nightly, test-msrv, fuzz ]
125135 if : always()
126136 runs-on : ubuntu-latest
@@ -134,11 +144,13 @@ jobs:
134144 # Some dependencies of the `ci-passed` job might be skipped, but we still want to run if the `ci-passed` job succeeded.
135145 if : always() && startsWith(github.ref, 'refs/tags/') && needs.ci-passed.result == 'success'
136146 name : Publish to crates.io
147+ permissions :
148+ contents : read
137149 needs : [ ci-passed ]
138150 runs-on : ubuntu-latest
139151 steps :
140- - uses : actions/checkout@v6
141- with : { submodules: recursive }
152+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
153+ with : { persist-credentials: false, submodules: recursive }
142154 - name : Publish to crates.io
143155 run : cargo publish
144156 env :
0 commit comments