Build and test #1074
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
# branches: | |
# - master | |
pull_request: | |
branches: | |
- master | |
release: | |
types: | |
- created | |
schedule: | |
- cron: "0 7 * * 1" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- uses: browser-actions/setup-firefox@latest | |
- run: sudo apt-get install --yes --no-install-recommends optipng | |
- run: sudo apt-get remove --yes fonts-lato | |
- run: fc-list | |
- run: firefox --version | |
- run: google-chrome --version | |
- run: npm ci | |
- run: npm run setup-website | |
- run: npm run ci-xvfb | |
- run: npm run ci-build-website | |
- uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
verbose: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: On failure, create alternate baseline images in case the new behavior is correct | |
if: ${{ failure() }} | |
run: | | |
pip3 install girder_client | |
python3 tests/runners/baseline_images.py -cevb _build | |
- name: Upload test images on failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: images | |
path: | | |
_build/images | |
_build/Baseline*tgz | |
- name: Upload artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: | | |
dist/apidocs | |
dist/built | |
- name: Upload built website | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: website | |
path: | | |
website/public | |
unpinned: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Don't pin version to test with the latest common version | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- run: npm --version && node --version | |
- uses: browser-actions/setup-firefox@latest | |
- run: sudo apt-get remove --yes fonts-lato | |
- run: fc-list | |
- run: firefox --version | |
- run: google-chrome --version | |
# Delete the package-lock to test with the latest libraries allowed | |
- run: rm package-lock.json | |
- run: npm install | |
- run: npm audit --audit-level high | |
- run: npm run setup-website | |
- run: npm run ci-xvfb | |
- run: npm run ci-build-website | |
deploy-website: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Import artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: website | |
path: website/public | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: website/public | |
force_orphan: true | |
deploy-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- run: npm ci | |
- name: Import artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Install semantic-release | |
run: npm install semantic-release --no-save | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release |