Skip to content

Commit

Permalink
add cache to common job. separate benchmark check
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed Sep 14, 2023
1 parent 2aafae3 commit 493b618
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 50 deletions.
30 changes: 22 additions & 8 deletions .github/actions/prep-ubuntu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ description: cleanup and Rust Tools setup
inputs:
RUST_TOOLCHAIN:
description: toolchain version
required: false
default: "1.66"
cache:
description: cache type (enabled if set)
default: "disabled"
GWIP:
description: "Google Workload identity provider"
default: ''
GSA:
description: "Google Service Account"
default: ''
runs:
using: composite
steps:
Expand All @@ -25,10 +33,16 @@ runs:
with:
toolchain: ${{ inputs.RUST_TOOLCHAIN }}
default: true
# - name: Install Rust Toolchain
# shell: bash
# id: install_toolchain
# env:
# RUST_TOOLCHAIN: inputs.RUST_TOOLCHAIN
# run: |
# ./scripts/install_toolchain.sh

- name: SCcache setup
if: ${{ inputs.cache_type == 'enabled' }}
uses: ./.github/actions/sccache-gcloud
with:
GWIP: ${{ secrets.GWIP_SCCACHE }}
GSA: ${{ secrets.GSA_SCCACHE }}

- name: setup Rust sccache wrapper
shell: sh
run: echo "RUSTC_WRAPPER="sccache"" >> $GITHUB_ENV


11 changes: 2 additions & 9 deletions .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,14 @@ jobs:
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ matrix.rust_version }}


# sccache does not work inside the srtool container
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # 2.6.2
with:
prefix-key: build
shared-key: wasm
# save-if: ${{ github.ref == 'refs/heads/master' }}

# TEST 2: Sccache with Google Buckets
# FAILED: does not work inside the srtool container
# - name: SCcache setup
# uses: ./.github/actions/sccache-gcloud
# with:
# GWIP: ${{ secrets.GWIP_SCCACHE }}
# GSA: ${{ secrets.GSA_SCCACHE }}

- name: Setup build options
id: buildopt
run: |
Expand Down
57 changes: 24 additions & 33 deletions .github/workflows/sanity-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
paths:
- 'src/'
- '.github/workflows/tests.yml'
- '.github/workflows/sanity-checks.yml'
name: Sanity checks
concurrency:
group: 'tests-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand All @@ -13,23 +13,15 @@ permissions:
id-token: write
contents: read
jobs:
lint-test-build:
name: ${{ matrix.target }}${{ format('-{0}, matrix.runtime') || '' }}
test-n-lint:
name: ${{ matrix.target }}
runs-on: ubuntu-latest-4-cores
strategy:
matrix:
target: [tests-general, test-integration,
lint-fmt, lint-clippy, cargo-build, benchmark-check] # ,lint-taplo]
include:
- target: benchmark-check
runtime: development
- target: benchmark-check
runtime: altair
- target: benchmark-check
runtime: centrifuge
target: [test-general, test-integration,
lint-fmt, lint-clippy, cargo-build] # ,lint-taplo]
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
# SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Check out code
Expand All @@ -39,29 +31,28 @@ jobs:
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }}

# - name: Swatinem rust cache setup
# uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # 2.6.0
# with:
# prefix-key: cache
# shared-key: cargo-tests
# # cache-on-failure: "true"
# # save-if: ${{ github.ref == 'refs/heads/master' }}

- name: SCcache setup
uses: ./.github/actions/sccache-gcloud
with:
GWIP: ${{ secrets.GWIP_SCCACHE }}
GSA: ${{ secrets.GSA_SCCACHE }}
setup_cache: true
cache_type: sccache_gcloud

- name: Runing cargo ${{ matrix.target }}
run: ./ci/run-check.sh
env:
TARGET: ${{ matrix.target }}
RUNTIME: ${{ matrix.runtime }}

# RUNTIME: ${{ matrix.runtime }}

# - name: Run tests
# run: ./ci/script.sh
# env:
# TARGET: ${{ matrix.target }}
benchmark-check:
name: bench-${{ matrix.runtime }}
runs-on: ubuntu-latest-4-cores
strategy:
matrix:
runtime: [development, altair, centrifuge]
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2
- name: Runing cargo ${{ matrix.target }}
run: ./ci/run-check.sh
env:
TARGET: benchmark-check
RUNTIME: ${{ matrix.runtime }}

0 comments on commit 493b618

Please sign in to comment.