-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f2320c
commit 1d6f608
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: "Get & Cache Dependencies" | ||
description: "Get the dependencies (via npm) and cache them for later use." | ||
inputs: | ||
caching: | ||
description: "Whether to cache the dependencies or not." | ||
required: false | ||
default: "true" | ||
outputs: | ||
used-cache: | ||
description: "Whether the cache was used or not." | ||
value: ${{ steps.set-output.outputs.used-cache }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
if: inputs.caching == 'true' | ||
id: cache | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
- name: Install dependencies | ||
id: install | ||
if: steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true' | ||
shell: bash | ||
run: npm ci | ||
- name: Set output | ||
id: set-output | ||
shell: bash | ||
run: echo "used-cache='${{ steps.cache.outputs.cache-hit }}'" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Test and Build the Application | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.1" | ||
- name: Load & cache dependencies | ||
uses: ./.github/actions/cached-deps | ||
- name: Run the linter | ||
run: npm run lint -- --max-warnings=0 | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.1" | ||
- name: Load & cache dependencies | ||
uses: ./.github/actions/cached-deps | ||
- name: Run tests | ||
run: npm test | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.11.1" | ||
- name: Load & cache dependencies | ||
uses: ./.github/actions/cached-deps | ||
id: chached-deps | ||
- name: Build the application | ||
run: npm run build | ||
- name: Upload artifacts | ||
if: success() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-files | ||
path: dist | ||
report: | ||
runs-on: ubuntu-latest | ||
needs: [lint, build] | ||
if: failure() | ||
steps: | ||
- name: Output information | ||
run: | | ||
echo "Something went wrong!" | ||
echo "${{ toJson(github)}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters