fix: allow attaching independent PDF for reviews #1307
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 | |
on: | |
# Run this workflow for pushes on all branches | |
push: | |
branches: | |
- '**' | |
# Run this workflow when a tag or branch is created | |
create: | |
# Run this workflow for pull requests | |
pull_request: | |
jobs: | |
run_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install 'poetry' | |
poetry install | |
env: | |
SETUPTOOLS_USE_DISTUTILS: stdlib | |
- name: Run tests | |
run: | | |
poetry run coverage run manage.py test --settings=observation_portal.test_settings | |
poetry run coverage xml | |
env: | |
DB_USER: postgres | |
DB_PASS: postgres | |
DB_HOST: localhost | |
DB_PORT: 5432 | |
- name: Generate and send coveralls report | |
uses: coverallsapp/[email protected] | |
with: | |
parallel: true | |
coverage-reporter-version: v0.6.9 | |
finish: | |
runs-on: ubuntu-latest | |
needs: run_tests | |
steps: | |
- name: Close parallel build | |
uses: coverallsapp/[email protected] | |
with: | |
parallel-finished: true | |
coverage-reporter-version: v0.6.9 | |
publish_to_pypi: | |
# Only run this job if the run_tests job has succeeded, and if | |
# this workflow was triggered by the creation of a new tag | |
needs: run_tests | |
if: github.event_name == 'create' && github.event.ref_type == 'tag' && github.event.repository.fork == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install 'poetry' | |
- name: Build package and publish to PyPI | |
run: | | |
poetry build -f wheel | |
poetry build -f sdist | |
poetry publish -u "__token__" -p '${{ secrets.PYPI_OBS_PORTAL_API_TOKEN }}' | |
env: | |
SETUPTOOLS_USE_DISTUTILS: stdlib | |
build_and_publish_image: | |
# Only run this job if the run_tests job has succeeded, the new version was pushed to pypi, | |
# and if this workflow was triggered by the creation of a new tag | |
needs: [run_tests, publish_to_pypi] | |
if: github.event_name == 'create' && github.event.ref_type == 'tag' && github.event.repository.fork == false | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_REPOSITORY: observatorycontrolsystem/observation-portal | |
DOCKER_IMAGE_TAG: ${{ github.event.ref }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build image and push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
no-cache: true | |
pull: true | |
push: true | |
tags: ${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} |