chore(ci): Use latest action versions to avoid nodejs 16 warning #25
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] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: | |
- "3.11" | |
- "3.12" | |
steps: | |
- name: Checkout the source | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
cache-dependency-path: | | |
src/qedis-proxy/go.sum | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: | | |
setup.cfg | |
- name: Prepare environment | |
run: | | |
docker pull redis:7-alpine | |
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV # for uv to use the global interpreter | |
- name: Install dependencies | |
run: | | |
pip install -U uv | |
uv pip install -U -e '.[test]' | |
- name: Build the proxy | |
run: | | |
cd src/qedis-proxy | |
go build | |
- name: Test with pytest | |
timeout-minutes: 30 | |
run: | | |
python -m pytest -v --cov=src tests | |
- name: Send code coverage report | |
uses: codecov/codecov-action@v4 | |
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-qedis | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: | | |
setup.cfg | |
- name: Prepare environment | |
run: | | |
echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV # for uv to use the global interpreter | |
- name: Install dependencies | |
run: | | |
pip install -U uv | |
uv pip install -U -e '.[build]' | |
- name: Build sdist and wheel | |
run: | | |
python -m build -s -w | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |