Skip to content

fix: specify email password #491

fix: specify email password

fix: specify email password #491

Workflow file for this run

name: CI Tests
on:
push:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
debug_only_this_job:
type: boolean
description: 'Run the build with tmate debugging enabled for this job only'
required: false
default: false
issue_release:
type: boolean
description: 'Issue a release'
required: false
default: false
dry_release_run:
type: boolean
description: 'Do not actually release the package, just check that it is valid.'
required: false
default: false
allow_breaking_changes:
type: boolean
description: 'Skip API compatibility check. WARNING: this will allow breaking changes to the API to be released.'
required: false
default: false
jobs:
version:
uses: ./.github/workflows/get-version.yml
secrets: inherit
run-tests:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.check-tag.outputs.match }}
steps:
- uses: actions/checkout@v4
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.debug_enabled || inputs.debug_only_this_job) }}
- name: Setup docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
touch .env.secret
- name: Build container
run: docker-compose build app_test
- name: Run tests
run: docker-compose run --rm app_test
- name: Validate spec
run: |
docker-compose run --rm app_test bash -c "python manage.py spectacular --fail-on-warn --validate"
check-release-type:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.check-tag.outputs.release }}
dry-run: ${{ steps.check-tag.outputs.dry-run }}
needs:
- version
steps:
- name: Dump context
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
await core.group(`GitHub needs`, async () => {
core.info(JSON.stringify(JSON.parse(`${process.env.NEEDS}`), null, 2));
});
env:
NEEDS: ${{ toJson(needs) }}
- name: Check if tagged release is required
id: check-tag
run: |
set -euxo pipefail
DRY_RUN=false
RELEASE=false
# Determine release based on whether:
# 1. We're in a workflow_dispatch event and the inputs.issue_release flag is true
# 2. We're in a workflow_dispatch event and the inputs.dry_release_run flag is true
# 3. We're on a tag and the tag is a semver tag
# 4. We're on a branch and we have an unpublished version
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.issue_release }}" == "true" ]]; then
RELEASE=true
if [[ "${{ github.event.inputs.dry_release_run }}" == "true" ]]; then
DRY_RUN=true
echo "Issuing dry-run because dry_release_run flag is true"
else
echo "Issuing release because issue_release flag is true"
fi
elif [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.dry_release_run }}" == "true" ]]; then
DRY_RUN=true
RELEASE=true # requesting dry-run implies requesting release
echo "Issuing release because dry_release_run flag is true"
elif [[ "${{ github.event_name }}" == "push" ]]; then
IS_SEMVER=$(echo "${{ github.ref }}" | grep -cE "^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$" || true)
if [[ $IS_SEMVER -gt 0 ]]; then
RELEASE=true
echo "Issuing release because we're on a tag matching semver"
elif [[ "${{ needs.version.outputs.untagged }}" == "true" ]]; then
RELEASE=true
DRY_RUN=true
echo "Issuing dry-run because we're on a branch with an unpublished version"
fi
else
echo "Release/dry-run not requested or required."
fi
echo "release=$RELEASE" >> $GITHUB_OUTPUT
echo "dry-run=$DRY_RUN" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Debug with tmate
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.debug_enabled || inputs.debug_only_this_job) }}
uses: mxschmitt/action-tmate@v3
release:
needs:
- run-tests
- check-release-type
if: needs.check-release-type.outputs.release == 'true'
uses: ./.github/workflows/issue-release.yml
secrets: inherit
with:
debug_enabled: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
allow_breaking_changes: ${{ github.event_name == 'workflow_dispatch' && inputs.allow_breaking_changes }}
dry-run: ${{ needs.check-release-type.outputs.dry-run == 'true' }}
build-python:
needs:
- release
name: >-
Build 🐍📦
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python
path: .
# - name: Test python package
# run: |
# pip install -r requirements.txt
# pip install -r test-requirements.txt
# pytest test
- name: Build distribution 📦
run: python setup.py sdist bdist_wheel
- name: Save distribution 📦
uses: actions/upload-artifact@v4
with:
name: python-package
path: dist/*
publish-to-pypi:
needs:
- build-python
if: needs.check-release-type.outputs.dry-run == 'false'
name: >-
Publish Python 🐍 distribution 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/galv-client
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download distribution 📦
uses: actions/download-artifact@v4
with:
name: python-package
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-testpypi:
needs:
- build-python
if: needs.check-release-type.outputs.dry-run == 'true'
name: >-
Publish Python 🐍 distribution 📦 to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/galv-client
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download distribution 📦
uses: actions/download-artifact@v4
with:
name: python-package
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true