From 670d2cd7c749c115a19dcd5dd32456a96a7da8ba Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Sun, 10 Dec 2023 22:53:23 -0800 Subject: [PATCH 1/4] feat: add CI --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..387f47a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +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 + + - uses: amplium/git-crypt-action@master + with: + key_encoded: ${{ secrets.DECRYPTION_SECRET }} + + - run: npm run lint:quiet + + prettier: + runs-on: ubuntu-latest + + timeout-minutes: 15 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: amplium/git-crypt-action@master + with: + key_encoded: ${{ secrets.DECRYPTION_SECRET }} + + - run: npm run prettier:check - diff --git a/package.json b/package.json index 00b7dcb..118e524 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "scripts": { "start-booker": "node add-to-cart.mjs", "start-checker": "node check-for-changes.mjs", + "prettier:check": "prettier --check .", "prettier:write": "prettier --write .", + "lint:quiet": "npm run lint -- --quiet", "eslint:fix": "eslint . --ignore-path .gitignore --ext .mjs,.js --fix" } } From 27b768cd8d39692e59f8f518b47b42e3f56c4cdc Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Sun, 10 Dec 2023 23:14:09 -0800 Subject: [PATCH 2/4] feat: add a seperate action to setup project --- .github/actions/setup-project/action.yml | 24 ++++++++++++++++++++++++ .github/workflows/ci.yml | 12 +++++++----- package.json | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 .github/actions/setup-project/action.yml diff --git a/.github/actions/setup-project/action.yml b/.github/actions/setup-project/action.yml new file mode 100644 index 0000000..1c30f20 --- /dev/null +++ b/.github/actions/setup-project/action.yml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 387f47a..c74f65f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: amplium/git-crypt-action@master + - name: Setup project + uses: ./.github/actions/setup-project with: - key_encoded: ${{ secrets.DECRYPTION_SECRET }} + DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }} - - run: npm run lint:quiet + - run: npm run eslint:quiet prettier: runs-on: ubuntu-latest @@ -35,8 +36,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: amplium/git-crypt-action@master + - name: Setup project + uses: ./.github/actions/setup-project with: - key_encoded: ${{ secrets.DECRYPTION_SECRET }} + DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }} - run: npm run prettier:check - diff --git a/package.json b/package.json index 118e524..978a209 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "start-checker": "node check-for-changes.mjs", "prettier:check": "prettier --check .", "prettier:write": "prettier --write .", - "lint:quiet": "npm run lint -- --quiet", + "eslint:quiet": "npm run lint -- --quiet", "eslint:fix": "eslint . --ignore-path .gitignore --ext .mjs,.js --fix" } } From 3b42e4e362b3975a1d7090a1b8ec0a65069737f1 Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Sun, 10 Dec 2023 23:20:54 -0800 Subject: [PATCH 3/4] fix: correct eslint commands --- .github/workflows/ci.yml | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c74f65f..d703acd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,4 @@ jobs: with: DECRYPTION_SECRET: ${{ secrets.DECRYPTION_SECRET }} - - run: npm run prettier:check - + - run: npm run prettier:check diff --git a/package.json b/package.json index 978a209..3b20740 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "start-checker": "node check-for-changes.mjs", "prettier:check": "prettier --check .", "prettier:write": "prettier --write .", - "eslint:quiet": "npm run lint -- --quiet", - "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" } } From 3bff442cfed9c21488165b86d0d44e572dcde71b Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Sun, 10 Dec 2023 23:23:27 -0800 Subject: [PATCH 4/4] fix: set updated node versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3b20740..53721c4 100644 --- a/package.json +++ b/package.json @@ -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",