update: ci

This commit is contained in:
windingwind 2024-12-09 12:30:37 +01:00
parent e507bfbe1f
commit e94a163ae5
4 changed files with 12 additions and 61 deletions

View File

@ -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

8
.github/workflows/pullrequest.yml vendored Normal file
View File

@ -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

View File

@ -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:

View File

@ -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": {