Add GitHub Actions workflow for building and testing the app

This commit is contained in:
thomas-senechal
2025-01-05 21:49:39 +01:00
parent bd09683f94
commit 3db9ee2804
2 changed files with 75 additions and 0 deletions

35
.github/actions/yarn-install/action.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Yarn Install
description: Install Yarn v4 and run yarn install.
inputs:
working_directory:
description: The directory to install dependencies in.
required: false
default: "."
runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Yarn v4
shell: bash
run: |
corepack enable
corepack prepare yarn@4.5.0 --activate
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
${{ inputs.working_directory }}/node_modules
~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('${{ inputs.working_directory }}/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
shell: bash
run: yarn install --immutable
working-directory: ${{ inputs.working_directory }}

40
.github/workflows/app.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: App CI
on:
push:
paths:
- "app/**"
- ".github/workflows/app.yml"
- ".github/actions/**"
jobs:
install:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
uses: ./.github/actions/yarn-install
with:
working_directory: ./app
lint:
needs: install
runs-on: ubuntu-latest
steps:
- name: Run linter
run: yarn lint
working-directory: ./app
- name: Run prettier
run: yarn fmt
working-directory: ./app
test:
needs: install
runs-on: ubuntu-latest
steps:
- name: Install app dependencies
run: yarn install-app
working-directory: ./app
- name: Test
run: yarn test
working-directory: ./app