[pre-commit.ci] pre-commit autoupdate (#238) #311
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: tests | |
on: | |
push: | |
pull_request: | |
# Enable manual runs | |
workflow_dispatch: | |
inputs: | |
coredev: | |
description: 'Tests with development version of cellfinder-core?' | |
required: true | |
default: 'false' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neuroinformatics-unit/actions/lint@v1 | |
test: | |
needs: linting | |
runs-on: ${{ matrix.os }} | |
env: | |
INPUT_COREDEV: ${{ github.event.inputs.coredev }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Run across a mixture of Python versions and operating systems | |
include: | |
- os: macos-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.9" | |
- os: ubuntu-latest | |
python-version: "3.8" | |
steps: | |
- uses: neuroinformatics-unit/actions/test@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'tags') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools setuptools_scm wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
build-and-push-docker: | |
needs: deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |