|
| 1 | +name: Build and test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + # branches: |
| 6 | + # - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + release: |
| 11 | + types: |
| 12 | + - created |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - uses: actions/setup-node@v2 |
| 20 | + with: |
| 21 | + node-version: 15.x |
| 22 | + - uses: browser-actions/setup-firefox@latest |
| 23 | + - run: sudo apt-get install --yes --no-install-recommends cpio optipng |
| 24 | + - run: sudo apt-get remove --yes fonts-lato |
| 25 | + - run: fc-list |
| 26 | + - run: firefox --version |
| 27 | + - run: google-chrome --version |
| 28 | + - run: npm install |
| 29 | + - run: npm run setup-website |
| 30 | + - run: npm run ci-xvfb |
| 31 | + - run: npm run ci-build-website |
| 32 | + |
| 33 | + - name: Report coverage |
| 34 | + run: | |
| 35 | + pip3 install codecov |
| 36 | + codecov |
| 37 | +
|
| 38 | + - name: On failure, create alternate baseline images in case the new behavior is correct |
| 39 | + if: ${{ failure() }} |
| 40 | + run: | |
| 41 | + pip3 install girder_client |
| 42 | + python3 tests/runners/baseline_images.py -cevb _build |
| 43 | + - name: Upload test images on failure |
| 44 | + if: ${{ failure() }} |
| 45 | + uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: images |
| 48 | + path: | |
| 49 | + _build/images |
| 50 | + _build/Baseline*tgz |
| 51 | + - name: Upload artifacts |
| 52 | + if: ${{ always() }} |
| 53 | + uses: actions/upload-artifact@v2 |
| 54 | + with: |
| 55 | + name: dist |
| 56 | + path: | |
| 57 | + dist/apidocs |
| 58 | + dist/built |
| 59 | + - name: Upload built website |
| 60 | + if: ${{ success() }} |
| 61 | + uses: actions/upload-artifact@v2 |
| 62 | + with: |
| 63 | + name: website |
| 64 | + path: | |
| 65 | + website/public |
| 66 | + deploy-website: |
| 67 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 68 | + needs: build |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - name: Import artifacts |
| 72 | + uses: actions/download-artifact@v2 |
| 73 | + with: |
| 74 | + name: website |
| 75 | + path: website/public |
| 76 | + - name: Deploy |
| 77 | + uses: peaceiris/actions-gh-pages@v3 |
| 78 | + with: |
| 79 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + publish_dir: website/public |
| 81 | + force_orphan: true |
| 82 | + deploy-releases: |
| 83 | + if: ${{ startswith(github.ref, 'refs/tags/') }} |
| 84 | + needs: build |
| 85 | + runs-on: ubuntu-latest |
| 86 | + steps: |
| 87 | + - name: Import artifacts |
| 88 | + uses: actions/download-artifact@v2 |
| 89 | + with: |
| 90 | + name: dist |
| 91 | + path: dist |
| 92 | + - name: Create Release |
| 93 | + uses: softprops/action-gh-release@v1 |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + with: |
| 97 | + # name: "Version ${{ github.ref }}" |
| 98 | + draft: false |
| 99 | + prerelease: false |
| 100 | + files: | |
| 101 | + dist/built/geo.js |
| 102 | + dist/built/geo.min.js |
| 103 | + dist/built/geo.lean.js |
| 104 | + dist/built/geo.lean.min.js |
| 105 | + deploy-npm: |
| 106 | + if: ${{ startswith(github.ref, 'refs/tags/') }} |
| 107 | + needs: build |
| 108 | + runs-on: ubuntu-latest |
| 109 | + steps: |
| 110 | + - uses: actions/checkout@v2 |
| 111 | + - uses: actions/setup-node@v2 |
| 112 | + with: |
| 113 | + node-version: 15.x |
| 114 | + - name: Import artifacts |
| 115 | + uses: actions/download-artifact@v2 |
| 116 | + with: |
| 117 | + name: dist |
| 118 | + path: dist |
| 119 | + - uses: JS-DevTools/npm-publish@v1 |
| 120 | + with: |
| 121 | + token: ${{ secrets.NPM_TOKEN }} |
| 122 | + dry-run: true |
0 commit comments