Skip to content

feat(ci): cache build objects in between internal runs #2168

feat(ci): cache build objects in between internal runs

feat(ci): cache build objects in between internal runs #2168

Workflow file for this run

name: check
user: '1000:1000'

Check failure on line 2 in .github/workflows/check.yml

View workflow run for this annotation

GitHub Actions / check

Invalid workflow file

The workflow is not valid. .github/workflows/check.yml (Line: 2, Col: 1): Unexpected value 'user'
on:
push:
branches: [main, pre-release]
pull_request:
branches: [main, pre-release]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: lint
run: |
zig fmt --check src/ build.zig
check_style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: check style
run: python scripts/style.py --check src
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: build
run: |
zig build -Denable-tsan -p output/
zig build test -Denable-tsan=true -Dblockstore=hashmap -Dfilter="ledger" -Dno-run -p output/tsan
- run: chmod +x output/**/*
- uses: actions/upload-artifact@v4
with:
name: zig-build
path: output/
# # GitHub's CI runners for macos seem to alternate between using a x86 and an ARM machine
# # which is annoying to handle and results in them having invalid hardware info configurations
# # on the virtual machine. This leads to incorrect feature detection and the CI is flaky.
# #
# # If we at some point setup a self-hosted MacOS runner, we could work around the issue and
# # enable full testing on MacOS!
# build-macos:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: setup-zig
# uses: mlugg/setup-zig@v1
# with:
# version: 0.13.0
# - name: build
# run: zig build -Dtarget=aarch64-macos -Dcpu=apple_m3
test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: setup-zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- uses: actions/download-artifact@v4
with:
name: zig-build
path: output/
- name: test
run: |
output/bin/test
output/tsan/bin/test
kcov_test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: setup-zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- uses: actions/download-artifact@v4
with:
name: zig-build
path: output/
- name: Set up dependencies
run: sudo apt-get update
- name: install kcov
run: |
wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz
sudo tar xf kcov-amd64.tar.gz -C /
- name: fix kcov dependencies
run: |
cd /usr/lib/x86_64-linux-gnu/
sudo ln libopcodes-2.42-system.so libopcodes-2.38-system.so || echo libopcodes not found
sudo ln libbfd-2.42-system.so libbfd-2.38-system.so || echo libbfd not found
- name: run kcov
run: |
bash scripts/kcov_test.sh output/zig-out/bin/test
- name: print coverage report
run: |
python scripts/parse_kcov.py kcov-output/test/coverage.json
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup-zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: build
run: |
zig build sig fuzz -Doptimize=ReleaseSafe -Dno-run
- uses: actions/upload-artifact@v4
with:
name: zig-build-release
path: zig-out/
gossip:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build-release
timeout-minutes: 60
steps:
- uses: ./.github/workflows/setup.yml
with:
name: zig-build-release
- name: run gossip
run: bash scripts/gossip_test.sh 120 # in seconds
gossip_service_fuzz:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
timeout-minutes: 60
needs: build-release
steps:
- uses: ./.github/workflows/setup.yml
with:
name: zig-build-release
- name: run
run: ./zig-out/bin/fuzz gossip_service 19 10000
gossip_table_fuzz:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build-release
timeout-minutes: 60
steps:
- uses: ./.github/workflows/setup.yml
with:
name: zig-build-release
- name: run
run: ./zig-out/bin/fuzz gossip_table 19 100000
allocators_fuzz:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build-release
timeout-minutes: 60
steps:
- uses: ./.github/workflows/setup.yml
with:
name: zig-build-release
- name: run
run: ./zig-out/bin/fuzz allocators 19 10000
ledger_fuzz:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{matrix.os}}
needs: build-release
timeout-minutes: 60
steps:
- uses: ./.github/workflows/setup.yml
with:
name: zig-build-release
- name: run
run: ./zig-out/bin/fuzz ledger 19 10000
# benchmarks:
# if: ${{ github.ref != 'refs/heads/main' }}
# strategy:
# matrix:
# os: [ubuntu-latest]
# runs-on: ${{matrix.os}}
# timeout-minutes: 60
# steps:
# - name: checkout
# uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: setup zig
# uses: mlugg/setup-zig@v1
# with:
# version: 0.13.0
# - name: benchmarks
# run: zig build -Doptimize=ReleaseSafe benchmark -- all --metrics
# # Download previous benchmark result from cache (if exists)
# - name: Download previous benchmark data
# uses: actions/cache@v4
# with:
# path: ./cache
# key: ${{ runner.os }}-benchmark
# # Run `github-action-benchmark` action
# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@v1
# with:
# # What benchmark tool the output.txt came from
# tool: "customSmallerIsBetter"
# # Where the output from the benchmark tool is stored
# output-file-path: results/output.json
# # Where the previous data file is stored
# external-data-json-path: ./cache/benchmark-data.json
# # Workflow will fail when an alert happens
# fail-on-alert: true
# # GitHub API token to make a commit comment
# github-token: ${{ secrets.GITHUB_TOKEN }}
# # Enable alert commit comment
# comment-on-alert: true
# # Upload the updated cache file for the next job by actions/cache
# # only when running on the main branch
# save-data-file: false
# main_benchmarks:
# if: ${{ github.ref == 'refs/heads/main' }}
# strategy:
# matrix:
# os: [ubuntu-latest]
# runs-on: ${{matrix.os}}
# timeout-minutes: 60
# steps:
# - name: checkout
# uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: setup zig
# uses: mlugg/setup-zig@v1
# with:
# version: 0.13.0
# - name: benchmarks
# run: zig build -Doptimize=ReleaseSafe benchmark -- all --metrics
# # Download previous benchmark result from cache (if exists)
# - name: Download previous benchmark data
# uses: actions/cache@v4
# with:
# path: ./cache
# key: ${{ runner.os }}-benchmark
# # Run `github-action-benchmark` action
# - name: Store benchmark result
# uses: benchmark-action/github-action-benchmark@v1
# with:
# # What benchmark tool the output.txt came from
# tool: "customSmallerIsBetter"
# # Where the output from the benchmark tool is stored
# output-file-path: results/output.json
# # Where the previous data file is stored
# external-data-json-path: ./cache/benchmark-data.json
# # Workflow will fail when an alert happens
# fail-on-alert: true
# # Upload the updated cache file for the next job by actions/cache
# # only when running on the main branch (see if:)
# save-data-file: true