re-organizing sections #3725
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- master | |
- 'dev/**' | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
jobs: | |
preliminary: | |
runs-on: ubuntu-latest | |
outputs: | |
check_doc_modified: ${{steps.check_doc_modified.outcome}} | |
check_changelog_modified: ${{steps.check_changelog_modified.outcome}} | |
steps: | |
- name: Checkout Master | |
uses: actions/checkout@v2 | |
with: | |
ref: master | |
fetch-depth: 1000 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1000 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pkgmt | |
- name: Check Doc Modified | |
id: check_doc_modified | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] | |
then | |
echo "Pull request, running check_doc" | |
python -m pkgmt.fail_if_modified -b origin/master -e doc CHANGELOG.md | |
else | |
echo "This is not a pull request event" | |
echo "Running all tests" | |
exit 1 | |
fi | |
continue-on-error: true | |
- name: Check Changelog Modified | |
env: | |
labels_JSON: ${{ toJSON(github.event.pull_request.labels.*.name) }} | |
id: check_changelog_modified | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ] | |
then | |
# Check if the array contains "no-changelog" | |
if echo "$labels_JSON" | jq '. | contains(["no-changelog"])' | grep -q true; then | |
echo "PR contains no-changelog label" | |
else | |
echo "PR does not contain no-changelog label"; | |
echo "Checking if changelog is modified"; | |
echo "If this test fails, please add the no-changelog label to the PR or modify the changelog" | |
python -m pkgmt.fail_if_not_modified -b origin/master -i CHANGELOG.md | |
fi | |
else | |
exit 0 | |
fi | |
integration-test-live: | |
needs: [preliminary] | |
if: needs.preliminary.outputs.check_doc_modified == 'failure' | |
uses: ./.github/workflows/ci-integration-db-live.yaml | |
secrets: inherit | |
integration-test-non-live: | |
needs: [preliminary] | |
if: needs.preliminary.outputs.check_doc_modified == 'failure' | |
uses: ./.github/workflows/ci-integration-db.yaml | |
test: | |
needs: [preliminary] | |
if: needs.preliminary.outputs.check_doc_modified == 'failure' | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, '3.10', '3.11'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Lint | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade pkgmt codespell | |
pkgmt lint | |
codespell | |
- name: Install dependencies | |
run: | | |
pip install . | |
# check package is importable | |
python -c "import sql" | |
pip install ".[dev]" | |
pip install sqlalchemy -U | |
- name: Test with pytest | |
run: | | |
# ensure we're running sqlalchemy 2 | |
python -c "import sqlalchemy; assert int(sqlalchemy.__version__.split('.')[0]) == 2" | |
# run unit tests | |
pytest --durations-min=5 --ignore=src/tests/integration | |
- name: Upload failed images artifacts | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: failed-image-artifacts ${{ matrix.os }} ${{ matrix.python-version }} | |
path: result_images/ | |
test-sqlalchemy-v1: | |
needs: [preliminary] | |
if: needs.preliminary.outputs.check_doc_modified == 'failure' | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Lint | |
run: | | |
python -m pip install --upgrade pip pkgmt | |
pkgmt lint | |
- name: Install dependencies | |
run: | | |
pip install "sqlalchemy<2" | |
pip install ".[dev]" | |
- name: Test with pytest | |
run: | | |
# ensure we're running sqlalchemy 1 | |
python -c "import sqlalchemy; assert int(sqlalchemy.__version__.split('.')[0]) == 1" | |
# run tests | |
pytest --durations-min=5 --ignore=src/tests/integration | |
- name: Upload failed images artifacts sqlalchemyv1 | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: failed-image-artifacts-sqlalchemy ${{ matrix.os }} ${{ matrix.python-version }} | |
path: result_images/ | |
# run: pkgmt check | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install 'pkgmt[check]' | |
- name: Check project | |
run: | | |
pkgmt check | |
release: | |
needs: [test, test-sqlalchemy-v1, check, integration-test-non-live, integration-test-live] | |
if: startsWith(github.ref, 'refs/tags') && github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install pkgmt twine wheel --upgrade | |
- name: Release | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
TAG: ${{ github.ref_name }} | |
run: | | |
echo "tag is $TAG" | |
pkgmt release $TAG --production --yes |