Bump codecov/codecov-action from 3 to 4 #90
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 Pipeline | |
on: [ push, pull_request, workflow_dispatch ] | |
env: | |
PIP_CACHE_DIR: /tmp/pipcache | |
HOME_REPO: datakortet/ttcal | |
jobs: | |
ci-lint: | |
name: CI:Lint | |
runs-on: ubuntu-latest | |
env: | |
LINTDIR: ./ghlint | |
steps: | |
# setup environment | |
- uses: actions/checkout@v4 | |
- name: setup directories | |
shell: bash | |
run: | | |
mkdir -p $PIP_CACHE_DIR | |
mkdir -p $LINTDIR | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- run: pip install flake8 | |
- run: flake8 ttcal/** --max-line-length=199 | |
ci-test: | |
name: CI:Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11' ] | |
os: [ubuntu-latest] | |
# include: | |
# - python-version: '3.9' | |
# os: windows-latest | |
# - python-version: '3.9' | |
# os: macos-latest | |
# # - python-version: '3.10.0-rc.2' | |
# # os: ubuntu-latest | |
# # experimental: true | |
steps: | |
# setup environment | |
- uses: actions/checkout@v4 | |
- name: setup global directories | |
shell: bash | |
run: mkdir -p $PIP_CACHE_DIR | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: pip install -r requirements.txt | |
- run: pip install pytest coverage pytest-cov | |
- run: pip list | |
- run: pytest -vv --cov=ttcal tests | |
- name: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN}} | |
fail_ci_if_error: false | |
cd: | |
name: CD | |
needs: ci-test | |
runs-on: ubuntu-latest | |
steps: | |
# setup environment | |
- uses: actions/checkout@v4 | |
- name: setup directories | |
shell: bash | |
run: mkdir -p $PIP_CACHE_DIR | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Cleanup | |
run: | | |
rm -rf dist | |
rm -rf build | |
- run: pip install -U wheel packaging twine | |
- run: pip install -r requirements.txt | |
- run: python setup.py sdist bdist_wheel | |
- name: Upload packages as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Packages | |
path: dist/ | |
- name: Deploy to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO | |
shell: bash | |
run: | | |
twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/* | |
- name: Create Github release | |
uses: ncipollo/release-action@v1 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == env.HOME_REPO | |
with: | |
artifacts: "dist/*" | |
owner: datakortet | |
repo: ttcal | |
token: ${{ secrets.GITHUB_TOKEN }} |