Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: cache PR build results based on git tree hash #119

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,41 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get git tree hash
id: get-tree-hash
run: |
git rev-parse HEAD^{tree} > .tree-hash
echo "hash=$(cat .tree-hash)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
id: result-cache
with:
path: .tree-hash
key: success-${{ steps.get-tree-hash.outputs.hash }}-${{ matrix.partition }}

- name: Run sccache-cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: mozilla-actions/sccache-action@v0.0.4

- name: Install toolchain
if: steps.result-cache.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@nightly
with:
targets: thumbv6m-none-eabi,thumbv7m-none-eabi,thumbv7em-none-eabi

- name: rust cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
with:
key: "${{ matrix.partition }}"

- uses: taiki-e/install-action@v2
if: steps.result-cache.outputs.cache-hit != 'true'
with:
tool: cargo-binstall

- name: "installing prerequisites"
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
git config --global init.defaultBranch main
git config --global user.email "ci@riot-labs.de"
Expand All @@ -53,6 +70,7 @@ jobs:
sudo apt-get install ninja-build

- name: "riot-rs compilation test"
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
sccache --start-server || true # work around https://github.com/ninja-build/ninja/issues/2052

Expand Down
Loading