From 160994852af42db11cf2a6b2017d7f6e9d88f32e Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:19:59 +0100 Subject: [PATCH 01/10] test: Implement testing for Opera browser --- .github/workflows/bump-release-publish.yaml | 87 +++++++++------------ .github/workflows/test.yaml | 18 ++++- __tests__/popup.test.ts | 3 +- package-lock.json | 6 +- 4 files changed, 59 insertions(+), 55 deletions(-) diff --git a/.github/workflows/bump-release-publish.yaml b/.github/workflows/bump-release-publish.yaml index 80885f7e..049a07f8 100644 --- a/.github/workflows/bump-release-publish.yaml +++ b/.github/workflows/bump-release-publish.yaml @@ -8,9 +8,9 @@ on: # yamllint disable-line rule:truthy description: How to increase the version required: true options: - - major - - minor - - patch + - major + - minor + - patch release: type: boolean description: Create a new release @@ -22,18 +22,26 @@ jobs: name: Bump Version runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Automated Version Bump - id: version_bump - uses: phips28/gh-action-bump-version@v10.1.1 - with: - version-type: ${{ github.event.inputs.version }} - tag-prefix: 'v' - commit-message: 'ci: Bump version to {{version}}' - env: - GITHUB_USER: github-actions[bot] - GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + - name: Checkout + uses: actions/checkout@v4 + - name: Automated Version Bump + id: version_bump + uses: phips28/gh-action-bump-version@v10.1.1 + with: + version-type: ${{ github.event.inputs.version }} + tag-prefix: "v" + commit-message: "ci: Bump version to {{version}}" + env: + GITHUB_USER: github-actions[bot] + GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + - name: Publish + if: ${{ github.event.inputs.publish == 'true' }} + run: npm run release + env: + EXTENSION_ID: ${{ secrets.EXTENSION_ID }} + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} outputs: tag: ${{ steps.version_bump.outputs.newTag }} release: @@ -42,38 +50,17 @@ jobs: if: ${{ github.event.inputs.release == 'true' }} runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v4 - with: - configuration: changelog.json - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - uses: mikepenz/action-gh-release@v0.2.0-a03 - with: - body: ${{ steps.github_release.outputs.changelog }} - tag_name: ${{ needs.bump.outputs.tag }} - publish: - name: Publish - needs: bump - if: ${{ github.event.inputs.publish == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '>=21.2.0' - - name: Build & Publish - run: | - npm ci - npm run build - npm run release - env: - EXTENSION_ID: ${{ secrets.EXTENSION_ID }} - CLIENT_ID: ${{ secrets.CLIENT_ID }} - CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} - REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + - name: Checkout + uses: actions/checkout@v4 + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v4 + with: + configuration: changelog.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: mikepenz/action-gh-release@v0.2.0-a03 + with: + body: ${{ steps.github_release.outputs.changelog }} + tag_name: ${{ needs.bump.outputs.tag }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0f8b0289..0929a2ad 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -31,6 +31,9 @@ jobs: test: name: Test runs-on: ubuntu-latest + strategy: + matrix: + browser: [chrome, opera] steps: - name: Checkout uses: actions/checkout@v4 @@ -43,5 +46,18 @@ jobs: run: npm run build - name: Security Audit run: npm audit - - name: Test + - name: Install Opera + if: ${{ matrix.browser == 'opera' }} + run: | + sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' + sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' + apt-get update -y + apt-get install opera-stable -y + - name: Test (Chrome) + if: ${{ matrix.browser == 'chrome' }} run: npm t + - name: Test (Opera) + if: ${{ matrix.browser == 'opera' }} + run: | + export VITE_BROWSER_PATH=/usr/bin/opera12 + npm t diff --git a/__tests__/popup.test.ts b/__tests__/popup.test.ts index 8df1fb3c..736eefe5 100644 --- a/__tests__/popup.test.ts +++ b/__tests__/popup.test.ts @@ -48,8 +48,9 @@ describe('popup', () => { browser = await puppeteer.launch({ // headless: false, headless: 'new', - slowMo: 200, + slowMo: 400, args: puppeteerArgs, + executablePath: process.env.VITE_BROWSER_PATH, }); [page] = await browser.pages(); }); diff --git a/package-lock.json b/package-lock.json index 318b8c4b..1c909996 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bookmark-bar-switcher", - "version": "1.4.1", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bookmark-bar-switcher", - "version": "1.4.1", + "version": "1.4.0", "license": "MIT", "devDependencies": { "@faker-js/faker": "8.3.1", @@ -23,7 +23,7 @@ "@vue/eslint-config-typescript": "12.0.0", "bootstrap": "5.3.2", "chrome-webstore-upload-cli": "2.2.2", - "eslint": "^8.54.0", + "eslint": "8.54.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-deprecation": "2.0.0", "eslint-plugin-eslint-comments": "3.2.0", From 1cc208d46207707d1ca4b6858fd3e7cff3756454 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:22:26 +0100 Subject: [PATCH 02/10] ci: Fix workflow --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0929a2ad..e0e050d1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -49,10 +49,10 @@ jobs: - name: Install Opera if: ${{ matrix.browser == 'opera' }} run: | - sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' - sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' - apt-get update -y - apt-get install opera-stable -y + sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' + sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' + sudo apt-get update -y + sudo apt-get install opera-stable -y - name: Test (Chrome) if: ${{ matrix.browser == 'chrome' }} run: npm t From 4e5b8d76847ed5ab5b42d9a59ed42b356fc955af Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:24:16 +0100 Subject: [PATCH 03/10] ci: Fix workflow --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e0e050d1..4b2c3aba 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -59,5 +59,5 @@ jobs: - name: Test (Opera) if: ${{ matrix.browser == 'opera' }} run: | - export VITE_BROWSER_PATH=/usr/bin/opera12 + export VITE_BROWSER_PATH=/usr/bin/opera npm t From 0bd73ace3f09eae81cba7ff4ff48a0e6936be55f Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:30:02 +0100 Subject: [PATCH 04/10] ci: Fix workflow --- .github/workflows/test.yaml | 93 ++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4b2c3aba..da6db845 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,61 +3,60 @@ name: Tests on: # yamllint disable-line rule:truthy push: paths-ignore: - - '*.md' - - '.github/dependabot.yaml' - - '.editorconfig' - - '.eslintignore' - - '.eslintrc.yaml' - - '.gitignore' - - '.markdownlint.yaml' - - '.prettierrc.yaml' - - 'LICENSE' - - '.yamllint.yaml' + - "*.md" + - ".github/dependabot.yaml" + - ".editorconfig" + - ".eslintignore" + - ".eslintrc.yaml" + - ".gitignore" + - ".markdownlint.yaml" + - ".prettierrc.yaml" + - "LICENSE" + - ".yamllint.yaml" pull_request: branches: - main paths-ignore: - - '*.md' - - '.github/dependabot.yaml' - - '.editorconfig' - - '.eslintignore' - - '.eslintrc.yaml' - - '.gitignore' - - '.markdownlint.yaml' - - '.prettierrc.yaml' - - 'LICENSE' - - '.yamllint.yaml' + - "*.md" + - ".github/dependabot.yaml" + - ".editorconfig" + - ".eslintignore" + - ".eslintrc.yaml" + - ".gitignore" + - ".markdownlint.yaml" + - ".prettierrc.yaml" + - "LICENSE" + - ".yamllint.yaml" jobs: test: name: Test runs-on: ubuntu-latest strategy: matrix: - browser: [chrome, opera] + browser: [Chrome, Opera] steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '>=21.2.0' - - name: Install - run: npm ci - - name: Build - run: npm run build - - name: Security Audit - run: npm audit - - name: Install Opera - if: ${{ matrix.browser == 'opera' }} - run: | - sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' - sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' - sudo apt-get update -y - sudo apt-get install opera-stable -y - - name: Test (Chrome) - if: ${{ matrix.browser == 'chrome' }} - run: npm t - - name: Test (Opera) - if: ${{ matrix.browser == 'opera' }} - run: | - export VITE_BROWSER_PATH=/usr/bin/opera - npm t + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ">=21.2.0" + - name: Install + run: npm ci + - name: Build + run: npm run build + - name: Security Audit + run: npm audit + - name: Test + run: | + if [ "${{ matrix.browser }}" = "Chrome" ]; then + echo "Testing on Chrome browser" + npm t + else + echo "Testing on Opera browser" + sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' + sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' + sudo apt-get update -y + sudo apt-get install opera-stable -y + export VITE_BROWSER_PATH=/usr/bin/opera + npm t + fi From a4a9bf103007c628acd8ae1b73a5733198096668 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:34:13 +0100 Subject: [PATCH 05/10] ci: Reduce slowMo --- __tests__/popup.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/popup.test.ts b/__tests__/popup.test.ts index 736eefe5..b738397c 100644 --- a/__tests__/popup.test.ts +++ b/__tests__/popup.test.ts @@ -48,7 +48,7 @@ describe('popup', () => { browser = await puppeteer.launch({ // headless: false, headless: 'new', - slowMo: 400, + slowMo: 200, args: puppeteerArgs, executablePath: process.env.VITE_BROWSER_PATH, }); From 841ba8a0e9a082a00b4f5874eb98662ceca9d114 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:40:18 +0100 Subject: [PATCH 06/10] ci: Fix workflow --- .github/workflows/test.yaml | 2 -- __tests__/popup.test.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index da6db845..2cfb2761 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -53,8 +53,6 @@ jobs: npm t else echo "Testing on Opera browser" - sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' - sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' sudo apt-get update -y sudo apt-get install opera-stable -y export VITE_BROWSER_PATH=/usr/bin/opera diff --git a/__tests__/popup.test.ts b/__tests__/popup.test.ts index b738397c..d135a5e5 100644 --- a/__tests__/popup.test.ts +++ b/__tests__/popup.test.ts @@ -48,7 +48,7 @@ describe('popup', () => { browser = await puppeteer.launch({ // headless: false, headless: 'new', - slowMo: 200, + slowMo: 100, args: puppeteerArgs, executablePath: process.env.VITE_BROWSER_PATH, }); From 6f72ac263b05922e504791ed7511790ecdcd9d3e Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:41:26 +0100 Subject: [PATCH 07/10] ci: Fix workflow --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2cfb2761..da6db845 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -53,6 +53,8 @@ jobs: npm t else echo "Testing on Opera browser" + sudo sh -c 'echo "deb http://deb.opera.com/opera/ stable non-free" >> /etc/apt/sources.list.d/opera.list' + sudo sh -c 'wget -O - http://deb.opera.com/archive.key | apt-key add -' sudo apt-get update -y sudo apt-get install opera-stable -y export VITE_BROWSER_PATH=/usr/bin/opera From c2b50117611a2bd2fa27acb3fc31b3957a92a0a7 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:44:04 +0100 Subject: [PATCH 08/10] ci: Fix workflow --- __tests__/popup.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/popup.test.ts b/__tests__/popup.test.ts index d135a5e5..b738397c 100644 --- a/__tests__/popup.test.ts +++ b/__tests__/popup.test.ts @@ -48,7 +48,7 @@ describe('popup', () => { browser = await puppeteer.launch({ // headless: false, headless: 'new', - slowMo: 100, + slowMo: 200, args: puppeteerArgs, executablePath: process.env.VITE_BROWSER_PATH, }); From 7202d35c74dde9d70ed146e5e5e680385daf4c74 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Thu, 23 Nov 2023 22:48:17 +0100 Subject: [PATCH 09/10] docs: Update README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 22861d6c..66ecdfea 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,11 @@ recreating and extending the functionality of the original. Currently, this extension supports Chromium browsers only. -| Browser | Support Level | -| ------- | ------------------------------------------------------------------------------------------------ | -| **Chrome** | *Officially Supported* (with automated tests) | -| **Opera** | *Unofficially Supported* as a Chrome-compatible target (but not explicitly tested in automation) | -| **Edge** | *Unofficially Supported* as a Chrome-compatible target (but not explicitly tested in automation) | +| Browser | Support Level | +| ---------- | ------------------------------------------------------------------------------------------------ | +| **Chrome** | *Officially Supported* (with automated tests) | +| **Opera** | *Officially Supported* (with automated tests) | +| **Edge** | *Unofficially Supported* as a Chrome-compatible target (but not explicitly tested in automation) | ## How to Use From aea519c5e923761ed37e5d3a16fa59deb5a2d832 Mon Sep 17 00:00:00 2001 From: Daniel Purtov Date: Sat, 25 Nov 2023 15:56:57 +0100 Subject: [PATCH 10/10] ci: Add recommended extensions --- .vscode/extensions.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..a5d0c006 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "PKief.material-icon-theme", + "streetsidesoftware.code-spell-checker", + "EditorConfig.EditorConfig", + "github.vscode-github-actions", + "DavidAnson.vscode-markdownlint", + "rvest.vs-code-prettier-eslint", + "Vue.vscode-typescript-vue-plugin", + "Vue.volar", + "dbaeumer.vscode-eslint" + ] +}