refactor for tox and makefile #30
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_CD | |
on: | |
push: | |
pull_request: | |
concurrency: | |
group: >- | |
${{ github.workflow }}- | |
${{ github.ref_type }}- | |
${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
env: | |
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }} | |
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }} | |
FLIT_INDEX_URL: ${{ secrets.FLIT_INDEX_URL }} | |
jobs: | |
test: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: ["ubuntu-latest"] | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run tests | |
run: make test | |
deploy: | |
runs-on: "ubuntu-latest" | |
needs: test | |
strategy: | |
matrix: | |
platform: ["ubuntu-latest"] | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Dynamic versioning | |
run: | | |
python -m pip install --upgrade pip | |
pip install versiontag flit | |
python .ci/versioning.py | |
- name: Publish testpypi | |
run: | | |
make publish | |
- name: Publish pypi | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
run: | | |
export FLIT_INDEX_URL=${{ secrets.PROD_FLIT_INDEX_URL }} | |
export FLIT_USERNAME=${{ secrets.PROD_FLIT_USERNAME }} | |
export FLIT_PASSWORD=${{ secrets.PROD_FLIT_PASSWORD }} | |
make publish |