Skip to content

Commit

Permalink
Add CI for better error catching (#3)
Browse files Browse the repository at this point in the history
* feat: add CI

* feat: add a seperate action to setup project

* fix: correct eslint commands

* fix: set updated node versions
  • Loading branch information
SudharakaP authored Dec 11, 2023
1 parent a61d45f commit 237b4d4
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
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"
}
}

0 comments on commit 237b4d4

Please sign in to comment.