Skip to content

Commit

Permalink
CI: Test reusable actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mintoo200 committed Mar 14, 2024
1 parent 8e2a9e1 commit c3687e9
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 46 deletions.
23 changes: 23 additions & 0 deletions .github/actions/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Build'

runs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
# TODO: add version to a .nvmrc or at least a variable
node-version: 18.12.1
cache: npm
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lib-${{ github.sha }}
path: ./dist
if-no-files-found: error
17 changes: 17 additions & 0 deletions .github/actions/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Run tests'

runs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
# TODO: add version to a .nvmrc or at least a variable
node-version: 18.12.1
cache: npm
- name: Install
run: npm ci --prefer-offline
- name: Run tests
run: npm run test:unit
7 changes: 7 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
on: [push, workflow_dispatch]

jobs:
run-tests:
uses: ./.github/actions/tests.yml
build:
uses: ./.github/actions/build.yml
26 changes: 0 additions & 26 deletions .github/workflows/build.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/tests.yml

This file was deleted.

0 comments on commit c3687e9

Please sign in to comment.