Skip to content

Commit 7860ca6

Browse files
authored
enable cache (#294)
* enable cache * update coverage
1 parent 8737e55 commit 7860ca6

File tree

3 files changed

+104
-94
lines changed

3 files changed

+104
-94
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ indent_style=space
1414
tab_width=4
1515

1616
[*.yml]
17-
indent_style=tab
17+
indent_style=space
1818
indent_size=2

.github/workflows/ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ jobs:
3535
- uses: awalsh128/cache-apt-pkgs-action@latest
3636
with:
3737
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev
38-
# - name: Cache SPM
39-
# uses: actions/cache@v4
40-
# with:
41-
# path: '**/.build'
42-
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
43-
# restore-keys: |
44-
# ${{ runner.os }}-spm-
38+
- uses: aws-actions/configure-aws-credentials@v4
39+
with:
40+
aws-region: us-east-2
41+
- name: Cache SPM
42+
uses: runs-on/cache@v4
43+
with:
44+
path: '**/.build'
45+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
46+
restore-keys: |
47+
${{ runner.os }}-spm-
48+
env:
49+
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
4550
- name: Cache Cargo
4651
uses: actions/cache@v4
4752
with:

.github/workflows/coverage.yml

Lines changed: 91 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,98 @@
11
name: Coverage
22

33
on:
4-
push:
5-
branches: ["master"]
6-
pull_request:
7-
branches: ["master"]
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
88

99
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
1212

1313
jobs:
14-
coverage:
15-
name: Code Coverage
16-
runs-on: [self-hosted, linux]
17-
timeout-minutes: 30
18-
steps:
19-
- name: Checkout Code
20-
uses: actions/checkout@v4
21-
with:
22-
submodules: recursive
23-
- run: sudo apt-get update
24-
- uses: awalsh128/cache-apt-pkgs-action@latest
25-
with:
26-
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev llvm
27-
# - name: Cache SPM
28-
# uses: actions/cache@v4
29-
# with:
30-
# path: '**/.build'
31-
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
32-
# restore-keys: |
33-
# ${{ runner.os }}-spm-
34-
- name: Cache Cargo
35-
uses: actions/cache@v4
36-
with:
37-
path: |
38-
~/.cargo/bin/
39-
~/.cargo/registry/index/
40-
~/.cargo/registry/cache/
41-
~/.cargo/git/db/
42-
target/
43-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44-
- name: Cache bandersnatch_vrfs static lib
45-
uses: actions/cache@v4
46-
with:
47-
path: .lib/libbandersnatch_vrfs.a
48-
key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }}
49-
restore-keys: |
50-
${{ runner.os }}-libs-libbandersnatch
51-
- name: Cache bls static lib
52-
uses: actions/cache@v4
53-
with:
54-
path: .lib/libbls.a
55-
key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }}
56-
restore-keys: |
57-
${{ runner.os }}-libs-libbls
58-
- name: Cache erasure-coding static lib
59-
uses: actions/cache@v4
60-
with:
61-
path: .lib/libec.a
62-
key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }}
63-
restore-keys: |
64-
${{ runner.os }}-libs-libec
65-
- name: Setup Swift
66-
uses: SwiftyLab/setup-swift@latest
67-
- name: Setup Rust
68-
uses: dtolnay/rust-toolchain@nightly
69-
- name: Build deps
70-
run: make deps
71-
- name: Test Coverage
72-
run: make test-coverage
73-
- name: Merge and generate coverage report
74-
run: |
75-
llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata
76-
for file in **/Tests; do
77-
BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")"
78-
XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest')
79-
for XCTEST_PATH in $XCTEST_PATHS; do
80-
echo "Processing $XCTEST_PATH"
81-
# Export the code coverage for the current subproject and append to coverage.lcov
82-
llvm-cov export "${XCTEST_PATH}" \
83-
-instr-profile=default.profdata \
84-
-format lcov >> coverage.lcov \
85-
-ignore-filename-regex=".build/repositories/*"
86-
done
87-
done
88-
- uses: codecov/codecov-action@v4
89-
with:
90-
file: coverage.lcov
91-
fail_ci_if_error: true # optional (default = false)
92-
token: ${{ secrets.CODECOV_TOKEN }} # required
93-
verbose: true # optional (default = false)
14+
coverage:
15+
name: Code Coverage
16+
runs-on: [self-hosted, linux]
17+
timeout-minutes: 30
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
- run: sudo apt-get update
24+
- uses: awalsh128/cache-apt-pkgs-action@latest
25+
with:
26+
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev llvm
27+
- uses: aws-actions/configure-aws-credentials@v4
28+
with:
29+
aws-region: us-east-2
30+
- name: Cache SPM
31+
uses: runs-on/cache@v4
32+
with:
33+
path: '**/.build'
34+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
35+
restore-keys: |
36+
${{ runner.os }}-spm-
37+
env:
38+
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
39+
- name: Cache Cargo
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
~/.cargo/bin/
44+
~/.cargo/registry/index/
45+
~/.cargo/registry/cache/
46+
~/.cargo/git/db/
47+
target/
48+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
49+
- name: Cache bandersnatch_vrfs static lib
50+
uses: actions/cache@v4
51+
with:
52+
path: .lib/libbandersnatch_vrfs.a
53+
key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }}
54+
restore-keys: |
55+
${{ runner.os }}-libs-libbandersnatch
56+
- name: Cache bls static lib
57+
uses: actions/cache@v4
58+
with:
59+
path: .lib/libbls.a
60+
key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }}
61+
restore-keys: |
62+
${{ runner.os }}-libs-libbls
63+
- name: Cache erasure-coding static lib
64+
uses: actions/cache@v4
65+
with:
66+
path: .lib/libec.a
67+
key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }}
68+
restore-keys: |
69+
${{ runner.os }}-libs-libec
70+
- name: Setup Swift
71+
uses: SwiftyLab/setup-swift@latest
72+
- name: Setup Rust
73+
uses: dtolnay/rust-toolchain@nightly
74+
- name: Build deps
75+
run: make deps
76+
- name: Test Coverage
77+
run: make test-coverage
78+
- name: Merge and generate coverage report
79+
run: |
80+
llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata
81+
for file in **/Tests; do
82+
BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")"
83+
XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest')
84+
for XCTEST_PATH in $XCTEST_PATHS; do
85+
echo "Processing $XCTEST_PATH"
86+
# Export the code coverage for the current subproject and append to coverage.lcov
87+
llvm-cov export "${XCTEST_PATH}" \
88+
-instr-profile=default.profdata \
89+
-format lcov >> coverage.lcov \
90+
-ignore-filename-regex=".build/repositories/*"
91+
done
92+
done
93+
- uses: codecov/codecov-action@v4
94+
with:
95+
file: coverage.lcov
96+
fail_ci_if_error: true # optional (default = false)
97+
token: ${{ secrets.CODECOV_TOKEN }} # required
98+
verbose: true # optional (default = false)

0 commit comments

Comments
 (0)