CI #765
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: | |
pull_request: | |
schedule: | |
- cron: "0 4 * * *" | |
release: | |
types: [created] | |
jobs: | |
egginfo: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: python -m pip install --upgrade tox | |
- name: egg-info vos | |
run: cd vos && tox -e egg_info | |
tests: | |
needs: egginfo | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"] | |
package: [vos] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install tox | |
# pytest-runner required to support deprecated Python3.5 | |
run: python -m pip install --upgrade tox pytest-runner | |
- name: Test ${{ matrix.package }} | |
run: | | |
# add py and remove the "." from python-version in order to get the tox_target | |
tox_target=$(echo py${{matrix.python-version}} | sed 's/\.//') | |
echo "Tox target: " $tox_target | |
cd ${{ matrix.package }} && tox -e $tox_target | |
style_n_coverage: | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v2 | |
- name: Install tox | |
run: python -m pip install --upgrade tox | |
- name: checkstyle & coverage vos | |
run: cd vos && tox -e checkstyle && tox -e cov | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./vos/coverage.xml | |
build-n-publish: | |
name: Build and publish to PyPI | |
needs: style_n_coverage | |
runs-on: ubuntu-latest | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
if: contains(github.ref, '=') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Determine the package | |
run: | | |
echo ${GITHUB_REF#refs/*/} | |
echo "repo_name=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $1}')" >> $GITHUB_ENV | |
echo "repo_version=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $2}')" >> $GITHUB_ENV | |
- name: Check version is valid | |
run: | | |
echo ${{ env.repo_name }} | |
echo ${{ env.repo_version }} | |
cd ${{ env.repo_name }} || (echo "Invalid release tag. Repo not found: ${{ env.repo_name }}" && exit -1) | |
sed 's/ //g' setup.cfg | grep "^version=${{ env.repo_version }}" || (echo "Version in tag ${{ env.repo_version }} does not match version in setup.cfg" && exit -1) | |
- name: Install dependencies | |
run: | | |
cd ${{ env.repo_name }} | |
python -m pip install --upgrade pip | |
pip install setuptools wheel | |
- name: Install package | |
run: | | |
cd ${{ env.repo_name }} | |
python setup.py sdist bdist_wheel | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${{ env.repo_name }}/dist/ |