Skip to content

Merge branch 'master' into task/deprecation-utility #1093

Merge branch 'master' into task/deprecation-utility

Merge branch 'master' into task/deprecation-utility #1093

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, 3.12]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
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
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
path: .coverage
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@v5
with:
python-version: "3.10"
- name: Download coverage
uses: actions/download-artifact@v4
with:
path: coverages/
# Not specifying any name will lead to the download of all available artifacts
# Since artifacts v2, we can no longer upload multiple artifacts
# with the same name and have them re-download as if it were a directory.
# For this reason, we need to download all available artifacts, filter
# out for only coverage files and then place them in the root directory
# with the name of the artifact
- name: Extract individual coverage files
run: |
cd coverages
for coverage_dir in ./.coverage.*; do
mv "$coverage_dir/.coverage" "../$coverage_dir"
rmdir "$coverage_dir"
done
cd ..
- name: Combine coverage
run: |
pip install -r dev-requirements/coverage.txt
coverage combine
coverage xml
coverage report
- name: Upload coverage to codeclimate
uses: paambaati/[email protected]
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@v5
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@v5
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@v5
with:
python-version: 3.9
- name: Setup node
uses: actions/setup-node@v4
- 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@v4
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