Skip to content

Commit

Permalink
enable cache (#294)
Browse files Browse the repository at this point in the history
* enable cache

* update coverage
  • Loading branch information
xlc authored Feb 18, 2025
1 parent 8737e55 commit 7860ca6
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ indent_style=space
tab_width=4

[*.yml]
indent_style=tab
indent_style=space
indent_size=2
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ jobs:
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev
# - name: Cache SPM
# uses: actions/cache@v4
# with:
# path: '**/.build'
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
# restore-keys: |
# ${{ runner.os }}-spm-
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-2
- name: Cache SPM
uses: runs-on/cache@v4
with:
path: '**/.build'
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
env:
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
- name: Cache Cargo
uses: actions/cache@v4
with:
Expand Down
177 changes: 91 additions & 86 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,98 @@
name: Coverage

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
push:
branches: ["master"]
pull_request:
branches: ["master"]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
coverage:
name: Code Coverage
runs-on: [self-hosted, linux]
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- run: sudo apt-get update
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev llvm
# - name: Cache SPM
# uses: actions/cache@v4
# with:
# path: '**/.build'
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
# restore-keys: |
# ${{ runner.os }}-spm-
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache bandersnatch_vrfs static lib
uses: actions/cache@v4
with:
path: .lib/libbandersnatch_vrfs.a
key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }}
restore-keys: |
${{ runner.os }}-libs-libbandersnatch
- name: Cache bls static lib
uses: actions/cache@v4
with:
path: .lib/libbls.a
key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }}
restore-keys: |
${{ runner.os }}-libs-libbls
- name: Cache erasure-coding static lib
uses: actions/cache@v4
with:
path: .lib/libec.a
key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }}
restore-keys: |
${{ runner.os }}-libs-libec
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: Build deps
run: make deps
- name: Test Coverage
run: make test-coverage
- name: Merge and generate coverage report
run: |
llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata
for file in **/Tests; do
BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")"
XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest')
for XCTEST_PATH in $XCTEST_PATHS; do
echo "Processing $XCTEST_PATH"
# Export the code coverage for the current subproject and append to coverage.lcov
llvm-cov export "${XCTEST_PATH}" \
-instr-profile=default.profdata \
-format lcov >> coverage.lcov \
-ignore-filename-regex=".build/repositories/*"
done
done
- uses: codecov/codecov-action@v4
with:
file: coverage.lcov
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
coverage:
name: Code Coverage
runs-on: [self-hosted, linux]
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive
- run: sudo apt-get update
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: librocksdb-dev libzstd-dev libbz2-dev liblz4-dev llvm
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-2
- name: Cache SPM
uses: runs-on/cache@v4
with:
path: '**/.build'
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
env:
RUNS_ON_S3_BUCKET_CACHE: laminar-gh-action-cache
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache bandersnatch_vrfs static lib
uses: actions/cache@v4
with:
path: .lib/libbandersnatch_vrfs.a
key: ${{ runner.os }}-libs-libbandersnatch-${{ hashFiles('Utils/Sources/bandersnatch/**') }}
restore-keys: |
${{ runner.os }}-libs-libbandersnatch
- name: Cache bls static lib
uses: actions/cache@v4
with:
path: .lib/libbls.a
key: ${{ runner.os }}-libs-libbls-${{ hashFiles('Utils/Sources/bls/**') }}
restore-keys: |
${{ runner.os }}-libs-libbls
- name: Cache erasure-coding static lib
uses: actions/cache@v4
with:
path: .lib/libec.a
key: ${{ runner.os }}-libs-libec-${{ hashFiles('Utils/Sources/erasure-coding/**') }}
restore-keys: |
${{ runner.os }}-libs-libec
- name: Setup Swift
uses: SwiftyLab/setup-swift@latest
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
- name: Build deps
run: make deps
- name: Test Coverage
run: make test-coverage
- name: Merge and generate coverage report
run: |
llvm-profdata merge -sparse $(find . -type f -path '*/.build/*/debug/codecov/*.profdata') -o default.profdata
for file in **/Tests; do
BIN_PATH="$(swift build --show-bin-path --package-path "$(dirname "$file")")"
XCTEST_PATHS=$(find "${BIN_PATH}" -name '*.xctest')
for XCTEST_PATH in $XCTEST_PATHS; do
echo "Processing $XCTEST_PATH"
# Export the code coverage for the current subproject and append to coverage.lcov
llvm-cov export "${XCTEST_PATH}" \
-instr-profile=default.profdata \
-format lcov >> coverage.lcov \
-ignore-filename-regex=".build/repositories/*"
done
done
- uses: codecov/codecov-action@v4
with:
file: coverage.lcov
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)

0 comments on commit 7860ca6

Please sign in to comment.