[pre-commit.ci] pre-commit autoupdate #624
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: default | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: | |
- "3.11" | |
- "3.12" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: | | |
setup.cfg | |
requirements/test.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements/test.txt | |
- name: Prepare testing | |
run: | | |
mkdir -p /tmp/etcd | |
docker run -d -p 2379:2379 -p 2380:2380 \ | |
-v /tmp/etcd:/etcd-data \ | |
--name backendai-etcd \ | |
quay.io/coreos/etcd:v3.4.1 \ | |
/usr/local/bin/etcd \ | |
--name backendai-etcd \ | |
--data-dir /etcd-data \ | |
--listen-client-urls http://0.0.0.0:2379 \ | |
--advertise-client-urls http://0.0.0.0:2379 \ | |
--listen-peer-urls http://0.0.0.0:2380 \ | |
--initial-advertise-peer-urls http://0.0.0.0:2380 \ | |
--initial-cluster backendai-etcd=http://0.0.0.0:2380 \ | |
--initial-cluster-token backendai-etcd-token \ | |
--initial-cluster-state new \ | |
--auto-compaction-retention 1 | |
- name: Test with pytest | |
timeout-minutes: 3 | |
run: | | |
python -m pytest -v --cov=src tests | |
- name: Send code coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
env_vars: GHA_OS,GHA_PYTHON | |
required-checks: | |
if: always() | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
deploy-to-pypi: | |
needs: [test] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
environment: deploy-to-pypi | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: | | |
requirements/build.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools | |
pip install -U -r requirements/build.txt | |
- name: Build sdist and wheel | |
run: | | |
python -m build -s -w | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |