From 46bde4c5a2fbdd798b61efb1949d3f78bc5b9b82 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 18 Jan 2021 03:00:54 -0500 Subject: [PATCH] Add GitHub Actions CI workflow and remove Travis config --- .github/workflows/ci.yml | 74 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 50 --------------------------- 2 files changed, 74 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..cc895d4848 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI +on: [push, pull_request] +jobs: + build: + name: Build, Upload, Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: 14 + + # On GitHub + - name: Install xvfb + if: env.ACT != 'true' + 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 + + - name: Cache Firefox + id: firefox-cache + uses: actions/cache@v2 + with: + path: firefox-x86_64 + key: firefox-60.9.0esr + + - name: Download Firefox + if: steps.firefox-cache.outputs.cache-hit != 'true' + run: wget -O tarball "https://zotero-download.s3.us-east-1.amazonaws.com/dev/firefox-60.9.0esr-x86_64-modified.tar.gz" + + - name: Extract Firefox + if: steps.firefox-cache.outputs.cache-hit != 'true' + run: tar xvf tarball + + - name: Cache Node modules + id: node-cache + uses: actions/cache@v2 + with: + path: node_modules + key: node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install Node modules + if: steps.node-cache.outputs.cache-hit != 'true' + run: npm install + + - name: Build Zotero + run: npm run build + + - name: Upload deployment ZIP + if: | + env.ACT != 'true' + && github.repository == 'zotero/zotero' + && github.event_name == 'push' + && (github.ref == 'refs/heads/master' || endsWith(github.ref, '-hotfix') || github.ref == 'refs/heads/gh-actions-ci-test') + 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 .. + sudo gem install --no-ri --no-rdoc dpl dpl-s3 + dpl --provider=s3 --bucket=zotero-download --local-dir=build-zip --upload-dir=ci/client --acl=public-read --skip_cleanup=true + + - name: Run tests + run: xvfb-run test/runtests.sh -x firefox-x86_64/firefox -f \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0ae5166e4..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -sudo: false -language: node_js -node_js: - - "8" -cache: - directories: - - "build" - - "node_modules" -env: - global: - secure: "NxvkbZ7/Op7BTGQRR3C4q8lLoO29f8WtyNN27NSH7AO3H0vBr1Vp5xO8gn+H2qHEug5HvM+YrZ/xAkNXaZVbOInmBmKVMxqVvdpKp9JM1Amf+gzsXWQphfySvs6iqzyP6cwU/jspdvX/WSakgU5v7PWXxtUIaKxdANt6Rw7W+Pc=" - matrix: - - FX_VERSION="60.8.0esr" -matrix: - fast_finish: true - #allow_failures: - # - env: FX_CHANNEL="beta" -addons: - apt: - packages: - - dbus-x11 -services: - - xvfb -install: - - wget -O tarball "https://zotero-download.s3.us-east-1.amazonaws.com/dev/firefox-60.9.0esr-x86_64-modified.tar.gz"; - - tar xf tarball -before_script: - - npm i - - npm run build - - if [[ $TRAVIS_REPO_SLUG = "zotero/zotero" && - ($TRAVIS_BRANCH = "master" || $TRAVIS_BRANCH = *-hotfix || $TRAVIS_BRANCH = "fx60") && - $TRAVIS_PULL_REQUEST = "false" ]]; then - mkdir build-zip; - cd build; - zip -r ../build-zip/$TRAVIS_COMMIT.zip *; - cd ..; - gem install dpl; - dpl --provider=s3 - --access-key-id=AKIAJFDVJ54MCAEXPQ5Q - --bucket=zotero-download - --local-dir=build-zip - --upload-dir=ci/client - --acl=public-read - --skip_cleanup=true; - fi - - unset AWS_SECRET_ACCESS_KEY - # Fix warnings in output - - dbus-launch -script: - - test/runtests.sh -x firefox-x86_64/firefox -f