Skip to content

Allow class listeners #5310

Allow class listeners

Allow class listeners #5310

Workflow file for this run

name: CI
on:
push:
branches-ignore:
- "dependabot/**"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
# Allows for matrix sub-jobs to fail without cancelling the rest
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.8, 3.9, "3.10", 3.11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Test Installation
shell: bash
run: |
pip install -r dev-requirements/build.txt
pip install .
pip uninstall -y hikari
pip install .[speedups]
pip uninstall -y hikari
- name: Run tests
shell: bash
run: |
pip install -r dev-requirements.txt
nox -s pytest
nox -s pytest-all-features -- --cov-append
python scripts/ci/normalize_coverage.py
mv .coverage .coverage.${{ matrix.os }}.${{ matrix.python-version }}
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
retention-days: 1
if-no-files-found: error
upload-coverage:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Download coverage
uses: actions/download-artifact@v3
with:
name: coverage
- name: Combine coverage
run: |
pip install -r dev-requirements/coverage.txt
coverage combine
coverage xml
coverage report
- name: Upload coverage to codeclimate
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: d40e64ea0ff74713f79365fea4378ab51a2141ad4fcf0fb118496bbf560d4192
with:
coverageLocations: .coverage.xml:coverage.py
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Check stubs
if: always()
run: |
pip install -r dev-requirements.txt
nox -s generate-stubs
if [ "$(git status --short)" ]; then
echo "Stubs were not updated accordingly to the changes. Please run 'nox -s generate-stubs' and commit the changes to fix this."
exit 1
fi
- name: Safety
if: always()
run: |
nox -s safety
- name: Mypy
if: always()
run: |
nox -s mypy
- name: Verify types
if: always()
run: |
nox -s verify-types
- name: Flake8
if: always()
run: |
nox -s flake8
- name: Slotscheck
if: always()
run: |
nox -s slotscheck
- name: Codespell
if: always()
run: |
nox -s codespell
- name: Check trailing whitespaces
if: always()
run: |
nox -s check-trailing-whitespaces
twemoji:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Test twemoji mapping
run: |
pip install -r dev-requirements.txt
nox -s twemoji-test
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup node
uses: actions/setup-node@v3
- name: Build documentation
run: |
pip install -r dev-requirements.txt
nox -s sphinx
- name: Upload artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: docs
path: public/docs
retention-days: 2
if-no-files-found: error
# Allows us to add this as a required check in Github branch rules, as all the other jobs are subject to change
ci-done:
needs: [upload-coverage, linting, twemoji, docs]
if: always() && !cancelled()
runs-on: ubuntu-latest
steps:
- name: Set status based on required jobs
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
run: |
for result in $RESULTS; do
if [ "$result" != "success" ]; then
exit 1
fi
done