Work on GH Actions #9
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: test | |
on: | |
push: | |
paths: | |
- '.github/workflows/test.yaml' | |
- 'lightbus/**' | |
- 'tests/**' | |
- 'poetry.lock' | |
- 'pyproject.toml' | |
- 'pytest.ini' | |
- 'lightbus_vendored/**' | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python: | |
# - '3.8' | |
# - '3.9' | |
# - '3.10' | |
- '3.11' | |
services: | |
redis: | |
image: redis:5 | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install | |
run: | | |
pip install poetry | |
poetry config virtualenvs.in-project true | |
poetry install | |
mkdir -p .coverage .test-reports | |
- name: Test | |
run: | | |
poetry run pytest --cov=lightbus --junit-xml=junit.xml -v -m "not benchmark" --maxfail=10 -k test_consume_rpcs_with_transport_error | |
mv .coverage/coverage .coverage/coverage-${{ github.run_number }} | |
- name: Upload code coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-reports | |
path: .coverage/* | |
code_coverage: | |
name: Code Coverage Reports | |
runs-on: ubuntu-22.04 | |
needs: test | |
steps: | |
- name: Download coverage reports | |
uses: actions/download-artifact@v3 | |
with: | |
name: code-coverage-reports | |
- name: Install coverage reporter | |
run: | | |
curl -Ls -o codacy-coverage-reporter "$(curl -Ls https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r '.assets | map({name, browser_download_url} | select(.name | contains("codacy-coverage-reporter-linux"))) | .[0].browser_download_url')" | |
chmod +x codacy-coverage-reporter | |
- name: Upload | |
run: | | |
./codacy-coverage-reporter report --help | |
./codacy-coverage-reporter report --api-token ${{ secrets.CODACY_API_TOKEN }} --organization-provider gh --username adamcharnock --project-name lightbus -r code-coverage-reports/* |