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

Add CI for better error catching #3

Merged
merged 4 commits into from
Dec 11, 2023
Merged
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
24 changes: 24 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup Project
description: Installs Node.js, NPM and dependencies and sets up the project

inputs:
DECRYPTION_SECRET:
description: The secret used to decrypt the files
required: true

runs:
using: 'composite'
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- name: Install dependencies
shell: bash
run: npm ci --prefer-offline --no-audit --progress=false

- uses: amplium/git-crypt-action@master
with:
key_encoded: ${{ inputs.DECRYPTION_SECRET }}
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
lint:
runs-on: ubuntu-latest

timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup project
uses: ./.github/actions/setup-project
with:
DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }}

- run: npm run eslint:quiet

prettier:
runs-on: ubuntu-latest

timeout-minutes: 15

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup project
uses: ./.github/actions/setup-project
with:
DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }}

- run: npm run prettier:check
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"puppeteer-extra-plugin-stealth": "^2.11.2"
},
"engines": {
"node": "18.x",
"npm": "9.x"
"node": "20.x",
"npm": "10.x"
},
"devDependencies": {
"eslint": "^8.55.0",
Expand All @@ -25,7 +25,10 @@
"scripts": {
"start-booker": "node add-to-cart.mjs",
"start-checker": "node check-for-changes.mjs",
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"eslint:fix": "eslint . --ignore-path .gitignore --ext .mjs,.js --fix"
"eslint": "eslint . --ignore-path .gitignore --ext .mjs,.js",
"eslint:quiet": "npm run eslint -- --quiet",
"eslint:fix": "npm run eslint --fix"
}
}