forked from Talus-Network/nexus-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.76 KB
/
pre-commit_(main).yml
File metadata and controls
58 lines (49 loc) · 1.76 KB
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
name: Pre-commit hook (main)
on:
push:
branches:
- main
# Fix for OOM.
env:
RUST_CACHE_VERBOSE: true
CARGO_BUILD_JOBS: 1
CARGO_INCREMENTAL: 0
RUSTFLAGS: >
-C codegen-units=1
jobs:
run-pre-commit:
name: Run pre-commit hook (main branch)
runs-on: ubuntu-latest
steps:
- name: Get architecture
id: get-arch
run: echo "ARCH=$(uname -m)" >> $GITHUB_OUTPUT
- name: Check out repository code
uses: actions/checkout@v4
- name: Compute cache keys
id: cache-keys
run: |
# `main` branch cache keys
echo "MAIN_CACHE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-${{ hashFiles('**/Cargo.lock') }}" >> $GITHUB_OUTPUT
echo "MAIN_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-main-" >> $GITHUB_OUTPUT
# PR branch cache keys
echo "PR_CACHE_RESTORE_KEY=v7-${{ runner.os }}-${{ steps.get-arch.outputs.ARCH }}-PR-" >> $GITHUB_OUTPUT
- name: Restore cache (main)
id: cache-restore
uses: ./.github/actions/cache/restore
with:
key: ${{ steps.cache-keys.outputs.MAIN_CACHE_KEY }}
restore-keys: |
${{ steps.cache-keys.outputs.MAIN_CACHE_RESTORE_KEY }}
${{ steps.cache-keys.outputs.MAIN_CACHE_RESTORE_KEY0 }}
${{ steps.cache-keys.outputs.PR_CACHE_RESTORE_KEY }}
- name: Install pre-commit dependencies
uses: ./.github/actions/pre-commit/dependencies
# Here it is ...
- name: Run pre-commit hook
run: ./.pre-commit/pre-commit
- name: Save cache (main)
uses: ./.github/actions/cache/save
if: ${{ always() }}
with:
key: ${{ steps.cache-restore.outputs.cache-primary-key }}