From 944b097243ec0a574ca02b90c8a708d6acd65618 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Mon, 26 Dec 2022 20:55:54 +0000 Subject: [PATCH 1/4] GitHub Actions: Linting and Testing --- .github/workflows/linting_testing.yml | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/linting_testing.yml diff --git a/.github/workflows/linting_testing.yml b/.github/workflows/linting_testing.yml new file mode 100644 index 0000000..410958c --- /dev/null +++ b/.github/workflows/linting_testing.yml @@ -0,0 +1,42 @@ +name: Linting and Testing + +on: + push: + branches: + - master + - dev + pull_request: + types: [opened, reopened, synchronize] + +jobs: + linting: + name: Run Linters + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install NPM packages + run: npm install + + - name: Run ESLint Report + run: npm run lint:report + # continue on error, so it still reports it in the next step + continue-on-error: true + + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@v2 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + report-json: "eslint_report.json" + + - name: Build Project + run: npm build + + From 33b30f62ed799bdea4cb48435a031cacf4bb818d Mon Sep 17 00:00:00 2001 From: William Oldham Date: Mon, 26 Dec 2022 20:57:40 +0000 Subject: [PATCH 2/4] Fix NPM Linting: Change ref from lib/ to src/ --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 02a2520..fca00b3 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "version": "1.0.0", "scripts": { "build": "vite build", - "lint": "eslint --ext .js lib/", - "lint:fix": "eslint --fix --ext .js lib/", - "lint:report": "eslint --ext .js --output-file eslint_report.json --format json lib/" + "lint": "eslint --ext .js src/", + "lint:fix": "eslint --fix --ext .js src/", + "lint:report": "eslint --ext .js --output-file eslint_report.json --format json src/" }, "devDependencies": { "eslint": "^8.30.0", From 3d77850762c9235e705e6135a5691f92e490c3b5 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Mon, 26 Dec 2022 20:59:30 +0000 Subject: [PATCH 3/4] Fix Github Actions: Yarn != NPM --- .github/workflows/linting_testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting_testing.yml b/.github/workflows/linting_testing.yml index 410958c..79ff925 100644 --- a/.github/workflows/linting_testing.yml +++ b/.github/workflows/linting_testing.yml @@ -37,6 +37,6 @@ jobs: report-json: "eslint_report.json" - name: Build Project - run: npm build + run: npm run build From 80086b746402d5e237ace350fd00a3036d942fd6 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Mon, 26 Dec 2022 21:03:45 +0000 Subject: [PATCH 4/4] GitHub Actions: Build Release --- .github/workflows/build_release.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build_release.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..98f4e3f --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,32 @@ +name: Build Release + +on: + push: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install NPM packages + run: npm install + + - name: Build project + run: npm run build + + - name: Upload production-ready build files + uses: actions/upload-artifact@v3 + with: + name: worker.js + path: ./dist/worker.js