|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + pull_request: |
| 8 | + |
| 9 | +env: |
| 10 | + TEST_TAG: user/myapp:test |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-20.04 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + - name: Read IMAGE_NAME |
| 20 | + id: image_name |
| 21 | + |
| 22 | + with: |
| 23 | + path: IMAGE_NAME |
| 24 | + - name: Login to ${{ steps.image_name.outputs.registry }} |
| 25 | + uses: docker/login-action@v1 |
| 26 | + with: |
| 27 | + registry: ${{ steps.image_name.outputs.registry }} |
| 28 | + username: ${{ secrets.REGISTRY_USER }} |
| 29 | + password: ${{ secrets.REGISTRY_PASSWORD }} |
| 30 | + - name: Docker meta |
| 31 | + id: meta |
| 32 | + uses: docker/metadata-action@v3 |
| 33 | + with: |
| 34 | + images: ${{ steps.image_name.outputs.registry }}/${{ steps.image_name.outputs.repository }} |
| 35 | + github-token: ${{ github.token }} |
| 36 | + - name: Set up Docker Buildx |
| 37 | + uses: docker/setup-buildx-action@v1 |
| 38 | + - name: Build and export to Docker |
| 39 | + uses: docker/build-push-action@v2 |
| 40 | + with: |
| 41 | + context: . |
| 42 | + load: true |
| 43 | + tags: ${{ env.TEST_TAG }} |
| 44 | + cache-from: type=gha |
| 45 | + cache-to: type=gha,mode=max |
| 46 | + - name: Test |
| 47 | + run: >- |
| 48 | + docker run --rm |
| 49 | + -v `pwd`/test_notebooks:/test_notebooks |
| 50 | + --user $(id -u):$(id -g) -e HOME=/tmp |
| 51 | + ${{ env.TEST_TAG }} |
| 52 | + jupyter nbconvert --to html --execute $NOTEBOOKS --output-dir=/test_notebooks/out |
| 53 | + env: |
| 54 | + # Need fix: cadquery.ipynb |
| 55 | + NOTEBOOKS: >- |
| 56 | + /test_notebooks/import-all.ipynb |
| 57 | + /test_notebooks/ipygany.ipynb |
| 58 | + /test_notebooks/ipyvtk-simple.ipynb |
| 59 | + /test_notebooks/panel.ipynb |
| 60 | + - name: Save notebook HTML out |
| 61 | + uses: actions/upload-artifact@v2 |
| 62 | + with: |
| 63 | + name: test-notebooks-html-out |
| 64 | + path: test_notebooks/out/*.html |
| 65 | + - name: Push the image |
| 66 | + uses: docker/build-push-action@v2 |
| 67 | + with: |
| 68 | + context: . |
| 69 | + push: ${{ github.event_name == 'push' && contains(github.ref, '/tags/v') }} |
| 70 | + tags: ${{ steps.meta.outputs.tags }} |
| 71 | + labels: ${{ steps.meta.outputs.labels }} |
| 72 | + cache-from: type=gha |
| 73 | + cache-to: type=gha,mode=max |
0 commit comments