π¬ππ¨ Explain that we didn't use wind #308
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: Test and publish | |
on: push | |
jobs: | |
build-image: | |
name: Build Docker image π | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@main | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and export | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
tags: islasgeci/nerd:latest | |
outputs: type=docker,dest=/tmp/image.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: image | |
path: /tmp/image.tar | |
test-module: | |
name: Test Python module π | |
needs: build-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@main | |
- name: Download artifact | |
uses: actions/download-artifact@main | |
with: | |
name: image | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Check format | |
run: docker run islasgeci/nerd:latest make check | |
- name: Test | |
run: docker run islasgeci/nerd:latest make coverage | |
- name: Run mutation testing | |
run: docker run islasgeci/nerd:latest make mutants | |
test-notebook: | |
name: Test Jupyter notebooks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@main | |
- name: Build demo Docker image | |
run: docker build --file example_notebooks/Dockerfile --tag=islasgeci/nerd_demo:latest --tag islasgeci/nerd_demo:${GITHUB_SHA:0:4} . | |
- name: Check notebook format | |
run: docker run islasgeci/nerd_demo:${GITHUB_SHA:0:4} make check_notebook | |
- name: Verify the notebooks run | |
run: docker run --volume ${PWD}/paper/figures:/workdir/figures --volume ${PWD}/tests/test_notebooks.sh:/workdir/tests/test_notebooks.sh islasgeci/nerd_demo:${GITHUB_SHA:0:4} tests/test_notebooks.sh | |
- name: Docker log-in | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin | |
- name: Push latest demo image to Docker Hub | |
run: docker push islasgeci/nerd_demo:latest | |
- name: Push demo SHA to Docker Hub | |
run: docker push islasgeci/nerd_demo:${GITHUB_SHA:0:4} | |
update-docker: | |
name: Push image to Docker Hub | |
needs: [test-notebook, test-module] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@main | |
- name: Docker log-in | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin | |
- name: Download artifact | |
uses: actions/download-artifact@main | |
with: | |
name: image | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Push latest Docker image to Docker Hub | |
run: docker push islasgeci/nerd:latest | |
- name: Push SHA tag to Docker Hub | |
run: | | |
docker tag islasgeci/nerd:latest islasgeci/nerd:${GITHUB_SHA:0:4} | |
docker push islasgeci/nerd:${GITHUB_SHA:0:4} | |
update-pypi: | |
name: Push module to PyPI | |
needs: test-module | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@main | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@main | |
with: | |
python-version: 3.9 | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir dist/ | |
. | |
- name: Publish distribution π¦ to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip-existing: true | |
verbose: true |