From 0f92f0f2ffbabf0ac48b8fadfb745a28b781d44d Mon Sep 17 00:00:00 2001 From: Jonathan Gangi Date: Tue, 2 Jul 2024 14:16:58 -0300 Subject: [PATCH 1/2] Add GitHub Actions for CI Validation This commit adds GitHub actions for CI validation Refers to SPSTRAT-293 --- .github/CODEOWNERS | 1 + .github/workflows/tox-test.yml | 104 +++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/tox-test.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..f9ec9a6 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @JAVGan @jajreidy diff --git a/.github/workflows/tox-test.yml b/.github/workflows/tox-test.yml new file mode 100644 index 0000000..fecc38a --- /dev/null +++ b/.github/workflows/tox-test.yml @@ -0,0 +1,104 @@ +name: Tox tests + +on: [push, pull_request] + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' + - name: Run Linting + run: tox -e lint + - name: Run MyPy + run: tox -e mypy + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json + python-version: ["3.8", "3.9", "3.10", "3.11"] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' + - name: Test on ${{ matrix.python-version }} + run: tox -e "py${{ matrix.python-version }}" + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' + - name: Run Tox + run: tox -e coverage + - name: Install pytest cov + run: pip install pytest-cov + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true + verbose: true + security: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' + - name: Run Tox + run: tox -e security + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' + - name: Run Tox + run: tox -e docs + From c5f83b0bde54a71ebab68fe9115814849e41004a Mon Sep 17 00:00:00 2001 From: Jonathan Gangi Date: Tue, 2 Jul 2024 15:15:29 -0300 Subject: [PATCH 2/2] Add PyPi release workflow Add PyPi release workflow Refers to SPSTRAT-293 --- .github/workflows/release.yml | 27 +++++++++++++++++++++++++++ .github/workflows/tox-test.yml | 24 +++++++++++++++++------- tox.ini | 2 +- 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5ef15ee --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release on PyPI + +on: + push: + tags: + - v* + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.github/workflows/tox-test.yml b/.github/workflows/tox-test.yml index fecc38a..a459cba 100644 --- a/.github/workflows/tox-test.yml +++ b/.github/workflows/tox-test.yml @@ -20,6 +20,21 @@ jobs: run: pip install tox 'virtualenv<20.21.1' - name: Run Linting run: tox -e lint + mypy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install OS packages + run: | + sudo apt-get -y update + sudo apt-get install -y rpm + sudo apt-get install -y libkrb5-dev + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install Tox + run: pip install tox 'virtualenv<20.21.1' - name: Run MyPy run: tox -e mypy unit-tests: @@ -58,15 +73,10 @@ jobs: python-version: 3.8 - name: Install Tox run: pip install tox 'virtualenv<20.21.1' - - name: Run Tox - run: tox -e coverage - name: Install pytest cov run: pip install pytest-cov - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - fail_ci_if_error: true - verbose: true + - name: Run Tox + run: tox -e coverage security: runs-on: ubuntu-latest steps: diff --git a/tox.ini b/tox.ini index 77dc5e4..73e2634 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = pip-compile, docs, lint, mypy, security, py38, py39, py310, py311 [testenv] envdir = {toxworkdir}/shared-environment setenv = - REQUESTS_CA_BUNDLE = {env:REQUESTS_CA_BUNDLE:/etc/pki/tls/cert.pem} + REQUESTS_CA_BUNDLE = {env:REQUESTS_CA_BUNDLE} PIP_INDEX_URL = {env:PIP_INDEX_URL:https://pypi.org/simple/} deps= -r requirements-test.txt