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

refactor: support running multiple jobs github actions #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
runs:
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node_modules
uses: actions/cache@v3
id: cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: |
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
64 changes: 35 additions & 29 deletions .github/workflows/workflow-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,23 @@ name: 'ci/cd'
on: [push, pull_request]

jobs:
test:
# Job name
name: test
# This job runs on Linux
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
installation:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/install-deps
- name: Installing packages...🏃‍♂️ 🏃‍♂️ 🏃‍♂️
run: npm ci
linter:
runs-on: ubuntu-20.04
needs: [installation]
concurrency: validation-${{ github.ref }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
id: checkout
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v2
id: cache
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: |
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/install-deps
- name: Installing packages...🏃‍♂️ 🏃‍♂️ 🏃‍♂️
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Running typecheck... 🩺 🔬 🔭
run: npm run code:typecheck
Expand All @@ -42,13 +29,32 @@ jobs:
run: npm run css:lint
- name: Running validation... 👨‍⚕️ 👩‍⚕️ 🩺
run: npm run code:validate
test:
runs-on: ubuntu-20.04
needs: [installation]
concurrency: validation-${{ github.ref }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/install-deps
- name: Installing packages...🏃‍♂️ 🏃‍♂️ 🏃‍♂️
run: npm ci
- name: Running unit test... 🤞 🚑 💊
run: npm run test:unit -- --runInBand --coverage
- name: Trigger codecov
run: bash <(curl -s https://codecov.io/bash)
build:
runs-on: ubuntu-20.04
needs: [installation, linter, test]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/install-deps
- name: Installing packages...🏃‍♂️ 🏃‍♂️ 🏃‍♂️
run: npm ci
- name: Run build Chrome
run: npm run app:chrome
- name: Run build Firefox
run: npm run app:firefox
- name: Run build Edge
run: npm run app:edge
run: npm run app:edge
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.20.1