2021-01-18 08:00:54 +00:00
|
|
|
name: CI
|
|
|
|
on: [push, pull_request]
|
2023-06-17 06:39:14 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-01-18 08:00:54 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build, Upload, Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-07 05:32:26 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-01-18 08:00:54 +00:00
|
|
|
with:
|
2021-03-03 10:29:48 +00:00
|
|
|
submodules: recursive
|
2023-05-20 11:02:21 +00:00
|
|
|
lfs: true
|
2021-01-18 08:00:54 +00:00
|
|
|
|
|
|
|
- name: Install Node
|
2023-04-07 05:32:26 +00:00
|
|
|
uses: actions/setup-node@v3
|
2021-01-18 08:00:54 +00:00
|
|
|
with:
|
2023-04-01 06:01:25 +00:00
|
|
|
node-version: 18
|
2021-07-22 08:44:25 +00:00
|
|
|
#cache: npm
|
2021-01-18 08:00:54 +00:00
|
|
|
|
|
|
|
# On GitHub
|
|
|
|
- name: Install xvfb
|
2023-04-29 09:51:13 +00:00
|
|
|
if: env.ACT != 'true'
|
2021-01-18 08:00:54 +00:00
|
|
|
run: sudo apt update && sudo apt install -y xvfb
|
|
|
|
|
|
|
|
# Local via act
|
|
|
|
- name: Install packages for act
|
|
|
|
if: env.ACT == 'true'
|
|
|
|
run: apt update && apt install -y zstd xvfb dbus-x11 libgtk-3-0 libx11-xcb1 libdbus-glib-1-2 libxt6
|
|
|
|
|
2023-04-29 09:51:13 +00:00
|
|
|
- name: Cache xulrunner
|
|
|
|
id: xulrunner-cache
|
2023-04-07 05:32:26 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-18 08:00:54 +00:00
|
|
|
with:
|
2023-04-29 09:51:13 +00:00
|
|
|
path: app/xulrunner/firefox-x86_64
|
|
|
|
key: xulrunner-${{ hashFiles('app/config.sh', 'app/scripts/fetch_xulrunner') }}
|
2021-01-18 08:00:54 +00:00
|
|
|
|
2023-04-29 09:51:13 +00:00
|
|
|
- name: Fetch xulrunner
|
|
|
|
if: steps.xulrunner-cache.outputs.cache-hit != 'true'
|
|
|
|
run: app/scripts/fetch_xulrunner -p l
|
2021-01-18 08:00:54 +00:00
|
|
|
|
|
|
|
- name: Cache Node modules
|
|
|
|
id: node-cache
|
2023-04-07 05:32:26 +00:00
|
|
|
uses: actions/cache@v3
|
2021-01-18 08:00:54 +00:00
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
|
|
|
|
|
|
|
- name: Install Node modules
|
|
|
|
if: steps.node-cache.outputs.cache-hit != 'true'
|
2023-04-13 04:55:38 +00:00
|
|
|
run: npm install
|
2021-01-18 08:00:54 +00:00
|
|
|
|
|
|
|
- name: Build Zotero
|
|
|
|
run: npm run build
|
2023-04-01 08:14:51 +00:00
|
|
|
# Currently necessary for pdf-worker Webpack: https://stackoverflow.com/a/69746937
|
|
|
|
env:
|
|
|
|
NODE_OPTIONS: --openssl-legacy-provider
|
2021-01-18 08:00:54 +00:00
|
|
|
|
|
|
|
- name: Upload deployment ZIP
|
|
|
|
if: |
|
|
|
|
env.ACT != 'true'
|
|
|
|
&& github.repository == 'zotero/zotero'
|
|
|
|
&& github.event_name == 'push'
|
2023-05-22 10:27:12 +00:00
|
|
|
&& (github.ref == 'refs/heads/main' || endsWith(github.ref, '-hotfix'))
|
2021-01-18 08:00:54 +00:00
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
run: |
|
|
|
|
mkdir build-zip
|
|
|
|
cd build
|
|
|
|
zip -r ../build-zip/$GITHUB_SHA.zip *
|
|
|
|
cd ..
|
2021-02-25 21:16:17 +00:00
|
|
|
sudo gem install --no-document dpl dpl-s3
|
2021-01-18 08:00:54 +00:00
|
|
|
dpl --provider=s3 --bucket=zotero-download --local-dir=build-zip --upload-dir=ci/client --acl=public-read --skip_cleanup=true
|
|
|
|
|
|
|
|
- name: Run tests
|
2023-04-29 09:51:13 +00:00
|
|
|
run: xvfb-run test/runtests.sh -f
|
2022-04-30 08:55:11 +00:00
|
|
|
|
|
|
|
- name: Cache utilities Node modules
|
|
|
|
id: utilities-node-cache
|
2023-04-07 05:32:26 +00:00
|
|
|
uses: actions/cache@v3
|
2022-04-30 08:55:11 +00:00
|
|
|
with:
|
|
|
|
path: chrome/content/zotero/xpcom/utilities/node_modules
|
|
|
|
key: utilities-node-modules-${{ hashFiles('chrome/content/zotero/xpcom/utilities/package-lock.json') }}
|
|
|
|
|
|
|
|
- name: Install utilities Node modules
|
|
|
|
if: steps.utilities-node-cache.outputs.cache-hit != 'true'
|
|
|
|
run: npm install --prefix chrome/content/zotero/xpcom/utilities
|
|
|
|
|
|
|
|
- name: Run utilities tests
|
|
|
|
run: |
|
|
|
|
npm test --prefix chrome/content/zotero/xpcom/utilities -- -j resource/schema/global/schema.json
|