From e94a163ae5d933ba2e0db1cccdaee919ce9ea885 Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:30:37 +0100 Subject: [PATCH] update: ci --- .github/workflows/ci.yml | 60 ------------------------------- .github/workflows/pullrequest.yml | 8 +++++ .github/workflows/release.yml | 3 ++ package.json | 2 +- 4 files changed, 12 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pullrequest.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 9c9cf9d..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: CI - -on: - push: - branches: - - master - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout Current Repository - uses: actions/checkout@v3 - - - name: Set Up Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" # Use the appropriate version for your project - - - name: Install xvfb # Required for running headless tests - if: env.ACT != 'true' - run: sudo apt update && sudo apt install -y xvfb - - - name: Clone Zotero Plugin Scaffold # TEMP: Use the official repository once the PR is merged - run: | - git clone --branch add-test https://github.com/windingwind/zotero-plugin-scaffold.git zotero-plugin-scaffold - cd zotero-plugin-scaffold - npm install - npm run build - - - name: Download and Extract Zotero Beta - run: | - wget -O zotero.tar.bz2 "https://www.zotero.org/download/client/dl?platform=linux-x86_64&channel=beta" - tar -xvf zotero.tar.bz2 - echo "Zotero extracted successfully" - - - name: Set Environment Variable for Zotero Bin Path - run: echo "ZOTERO_PLUGIN_ZOTERO_BIN_PATH=$PWD/Zotero_linux-x86_64/zotero" >> $GITHUB_ENV - - - name: Initialize Current Repository - run: | - npm install - - - name: Install Zotero Plugin Scaffold Locally - run: | - npm install ./zotero-plugin-scaffold - - - name: Run Tests - run: | - xvfb-run npx zotero-plugin test --abort-on-fail --exit-on-finish - env: - ZOTERO_PLUGIN_ZOTERO_BIN_PATH: ${{ env.ZOTERO_PLUGIN_ZOTERO_BIN_PATH }} - - - name: Check Test Results - if: failure() - run: | - echo "Tests failed. CI is marked as failed." - exit 1 diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml new file mode 100644 index 0000000..b304fd6 --- /dev/null +++ b/.github/workflows/pullrequest.yml @@ -0,0 +1,8 @@ +name: Pull Request CI + +on: + pull_request: + +jobs: + test: + uses: windingwind/zotero-plugin-scaffold/.github/workflows/plugin-test.yml@add-test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1b08e3..444fe89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,9 @@ permissions: pull-requests: write jobs: + test: + uses: windingwind/zotero-plugin-scaffold/.github/workflows/plugin-test.yml@add-test + release: runs-on: ubuntu-latest env: diff --git a/package.json b/package.json index 2eb7bd8..ef9dd6b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "build-dev": "tsc --noEmit && zotero-plugin build --dev && cd build/addon && zip -r ../zotero-better-notes-dev.xpi .", "release": "zotero-plugin release", "lint": "prettier --write . && eslint . --ext .ts --fix", - "test": "zotero-plugin test", + "test": "zotero-plugin test --abort-on-fail --exit-on-finish", "update-deps": "npm update --save" }, "repository": {