Update base_connector #44
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/CD | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # setuptools_scm needs this to calculate the version | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Save pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }} | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade --upgrade-strategy eager pip | |
- name: Install build dependencies | |
run: | | |
make deps-build | |
- name: Lint | |
run: make lint | |
- name: Static Analysis | |
run: make static | |
- name: Build | |
run: make build | |
- name: Check build | |
run: make check | |
- name: Archive build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: | | |
.lint | |
.static | |
.twinecheck | |
dist | |
build | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9","3.10","3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "::set-output name=dir::$(python -m pip cache dir)" | |
- name: Save pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }} | |
- name: Get date | |
id: date | |
run: echo "::set-output name=week::$(date '+%U')" | |
- name: Cache tox virtualenv & wheel cache | |
id: ghcache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/.tox | |
**/cache | |
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-${{ hashFiles('**/setup.py', '**/tox.ini') }}-${{ steps.date.outputs.week }}-${{ secrets.CACHE_VERSION }} | |
- name: Validate tox virtualenv | |
uses: techservicesillinois/cache-validation@v1 | |
id: tox | |
with: | |
path: .tox | |
cache_hit: ${{ steps.ghcache.outputs.cache-hit }} | |
remove_invalid_paths: true | |
touch: true | |
- name: Validate wheel cache | |
uses: techservicesillinois/cache-validation@v1 | |
id: cache | |
with: | |
path: cache | |
cache_hit: ${{ steps.ghcache.outputs.cache-hit }} | |
remove_invalid_files: true | |
touch: true | |
- name: Install system dependencies | |
if: matrix.os == 'ubuntu-latest' && steps.cache.outputs.valid != 'true' | |
run: | | |
sudo apt-get install -y libxml2-dev libxslt-dev | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade --upgrade-strategy eager pip | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade --upgrade-strategy eager tox wheel | |
- name: Update Python wheel cache | |
if: steps.cache.outputs.valid != 'true' | |
run: make cache | |
- name: Install | |
if: steps.tox.outputs.valid != 'true' | |
run: make install | |
- name: Run acceptance tests | |
run: | | |
make acceptance_test | |
- name: Installed dependencies | |
run: make freeze | |
- name: Tests | |
run: make test | |
# TODO: coverage is broken... | |
# - name: Coverage report | |
# run: make coverage report | |
- name: Archive coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ runner.os }}-py${{ matrix.python-version }} | |
path: htmlcov | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Save pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ secrets.CACHE_VERSION }} | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade --upgrade-strategy eager pip | |
- name: Install publish dependencies | |
run: | | |
make deps-publish | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
run: make release | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PROD_PYPI_TOKEN }} | |
TWINE_NON_INTERACTIVE: true | |
- name: Publish to Test PyPI | |
if: github.ref == 'refs/heads/main' | |
run: make test-release | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | |
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ | |
TWINE_NON_INTERACTIVE: true |