piotrmaslanka #114
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 | |
run-name: ${{ github.actor }} | |
on: [ push ] | |
jobs: | |
tests: | |
runs-on: ubuntu-20.04 | |
environment: Env1 | |
strategy: | |
matrix: | |
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9" ] | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/setup-python@main | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
- name: Before the coverage | |
run: | | |
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | |
chmod ugo+x test-reporter-latest-linux-amd64 | |
./test-reporter-latest-linux-amd64 before-build | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
- name: Install everything | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3-setuptools python3-yaml | |
pip install -U pip setuptools wheel disttools packaging pyproject.toml | |
- name: Install tools | |
run: pip install ".[test,dev]" | |
- name: Test | |
run: pytest -n 8 -vv --cov=satella | |
- name: Submit the code coverage | |
run: | | |
coverage xml | |
./test-reporter-latest-linux-amd64 after-build -t coverage.py | |
./test-reporter-latest-linux-amd64 format-coverage -t coverage.py -o codeclimate.json | |
./test-reporter-latest-linux-amd64 upload-coverage -i codeclimate.json | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
build-project: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/setup-python@main | |
name: Setup Python | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
- name: Update system | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3-setuptools python3-yaml | |
pip install -U pip setuptools wheel disttools packaging build | |
- name: Alter Version | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
run: | | |
echo -n '__version__ = "' > satella/__init__.py | |
echo -n $TAG_NAME >> satella/__init__.py | |
echo '"' >> satella/__init__.py | |
cat satella/__init__.py | |
env: | |
TAG_NAME: ${{ github.ref_name }} | |
- name: Build | |
run: python -m build . | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@main | |
with: | |
name: builds | |
path: | | |
dist | |
send-to-pypi: | |
runs-on: "ubuntu-20.04" | |
needs: [ "build-project", "tests" ] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
environment: Env1 | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/setup-python@main | |
name: Setup Python | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
- name: Install Twine | |
run: pip install twine | |
- name: Download all builds artifacts | |
uses: actions/download-artifact@main | |
with: | |
name: builds | |
- name: Send over packages to PyPI | |
run: | | |
echo $PYPIRC_PASSWORD_DATA > ~/.pypirc | |
twine upload /home/runner/work/satella/satella/satella*.whl /home/runner/work/satella/satella/satella*.tar.gz | |
env: | |
PYPIRC_PASSWORD_DATA: ${{ secrets.PYPIRC_PASSWORD_DATA }} | |