Skip to content

Commit

Permalink
Add caching on master
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Mar 26, 2024
1 parent da3c4b2 commit 4be1cdf
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
84 changes: 84 additions & 0 deletions .github/workflows/build-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: 'Build and Cache on master'
# We need to run build and cache on master so the PR's can use the cache
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache

on:
push:
branches:
- master

jobs:
js-build-pretier:
name: Check Build & Cache node modules
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules-v1
with:
path: |
node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Yarn install
run: yarn --prefer-offline --frozen-lockfile install
- name: Check JS build
run: yarn build

test-tauri:
name: Test Tauri build
runs-on: windows-latest

concurrency:
group: tests-tauri-build-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules-v1
with:
path: |
node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'

- name: Yarn install FE dependencies
run: yarn --prefer-offline --frozen-lockfile install

- name: Build tauri App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
4 changes: 3 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ jobs:

- name: Yarn install FE dependencies
run: yarn --prefer-offline --frozen-lockfile install
- uses: tauri-apps/tauri-action@v0

- name: Build tauri App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
Expand Down

0 comments on commit 4be1cdf

Please sign in to comment.