Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 30 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,42 @@
name: Python CI
name: CI

on:
push:
branches: [master]
pull_request:
branches:
- '**'
# Allow this workflow to be called from other workflows
workflow_call:

jobs:
run_tests:
name: Tests
runs-on: ${{ matrix.os }}
continue-on-error: true
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.12']
toxenv: [quality, data-django42, reporting-django42]
python-version: ["3.12"]
toxenv: [quality, py312-django42, py312-django52]

steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: setup python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Set env variable
run: export AWS_CONFIG_FILE=/dev/null

- name: check pip version
run: pip --version

- name: check pip-tools version
run: pip freeze

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Install GNU gettext
run: sudo apt-get install gettext

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Run Coverage
if: matrix.python-version == '3.12' && (matrix.toxenv=='django42-data' || matrix.toxenv=='django42-reporting')
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
python-version: "${{ matrix.python-version }}"

- name: Install CI dependencies
run: uv sync --group ci

- name: Run tox
run: uv run tox -e ${{ matrix.toxenv }}

- name: Upload coverage to Codecov
if: matrix.toxenv == 'py312-django52'
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: false
32 changes: 13 additions & 19 deletions .github/workflows/mysql8-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,44 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.12 ]
python-version: [ "3.12" ]

steps:
- name: Checkout repo
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
python-version: "${{ matrix.python-version }}"

- name: Install system Packages
run: |
sudo apt-get update
- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip dependencies
id: cache-dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/pip_tools.txt') }}
restore-keys: ${{ runner.os }}-pip-

- name: Ubuntu and sql Versions
run: |
lsb_release -a
mysql -V

- name: Install Python dependencies
run: |
pip install -r requirements/dev.txt
pip uninstall -y mysqlclient
pip install --no-binary mysqlclient mysqlclient
uv sync --group dev
uv pip uninstall mysqlclient
uv pip install --no-binary mysqlclient mysqlclient

- name: Initiate Services
run: |
sudo /etc/init.d/mysql start

- name: Reset mysql password
run: |
cat <<EOF | mysql -h 127.0.0.1 -u root --password=root
UPDATE mysql.user SET authentication_string = null WHERE user = 'root';
FLUSH PRIVILEGES;
EOF

- name: Run migrations
env:
DATABASES: default
Expand All @@ -72,5 +66,5 @@ jobs:
do
echo "CREATE DATABASE IF NOT EXISTS db_$db;" | sudo mysql -u root
export DB_NAME=db_$db
python manage.py migrate --noinput --run-syncdb --database "$db" --settings=enterprise_data.settings.test
uv run python manage.py migrate --noinput --run-syncdb --database "$db" --settings=enterprise_data.settings.test
done
31 changes: 0 additions & 31 deletions .github/workflows/pypi-publish.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
branches: [master]

jobs:
run_ci:
uses: ./.github/workflows/ci.yml
secrets: inherit
permissions:
contents: read

release:
needs: run_ci
runs-on: ubuntu-latest
if: github.ref_name == 'master'
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false

permissions:
contents: write

steps:
# Checkout the repository at the branch that triggered the workflow.
# Python Semantic Release will automatically convert shallow clones to
# full clones if needed. We reset to workflow sha to prevent accidentally
# releasing un-evaluated changes if branch was updated during workflow.
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.ref_name }}

- name: Force branch to workflow sha
run: git reset --hard ${{ github.sha }}

- name: Run Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@350c48fcb3ffcdfd2e0a235206bc2ecea6b69df0 # v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
changelog: "false"

- name: Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@310a9983a0ae878b29f3aac778d7c77c1db27378 # v10.5.3
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Upload distribution artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: steps.release.outputs.released == 'true'
with:
name: distribution-artifacts
path: dist
if-no-files-found: error

outputs:
released: ${{ steps.release.outputs.released || 'false' }}
version: ${{ steps.release.outputs.version }}

publish_to_pypi:
runs-on: ubuntu-latest
needs: release
if: github.ref_name == 'master' && needs.release.outputs.released == 'true'

permissions:
contents: read

steps:
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: distribution-artifacts
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdba # v1.12.4
with:
user: __token__
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
Loading