Automated code review for "remvoing-tools" #669
Workflow file for this run
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
# SPDX-FileCopyrightText: 2021 - 2023 Mewbot Developers <mewbot@quicksilver.london> | |
# | |
# SPDX-License-Identifier: BSD-2-Clause | |
name: Auto-Review | |
run-name: "Automated code review for \"${{ github.head_ref }}\"" | |
on: | |
push: | |
branches: | |
- mainline | |
pull_request: # All pull requests | |
concurrency: | |
group: review-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
# Which version of the reports Sonar receives. | |
DEFAULT_OS: ubuntu | |
DEFAULT_PYTHON: "3.10" | |
jobs: | |
test: | |
name: ${{ matrix.name }} Python code (${{ matrix.os }}/py${{ matrix.version }}) | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
name: ["lint", "test"] | |
os: ["ubuntu", "macos", "windows"] | |
version: ["3.10", "3.11"] | |
# Only Lint on Ubuntu (results should always be the same) | |
exclude: | |
- name: Lint | |
os: macos | |
- name: Lint | |
os: windows | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.version }} | |
cache: pip | |
cache-dependency-path: | | |
requirements.txt | |
requirements-dev.txt | |
- name: Install mewbot-dev-tools to allow dep install | |
shell: bash | |
run: pip install mewbot-dev-tools | |
- name: Install dependencies | |
shell: bash | |
run: python -m mewbot_dev_tools.install_deps | |
- name: Run Tests | |
shell: bash | |
run: | | |
PYTHONPATH="$(python -m mewbot_dev_tools.path)" | |
readonly PYTHONPATH | |
export PYTHONPATH | |
mewbot-${{ matrix.name }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ${{ matrix.name }}-results-${{ matrix.os }}-${{ matrix.version }} | |
path: reports | |
tests-passed: | |
name: Tests Passed | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- name: Mark all test runs as successful | |
run: /bin/true | |
annotate: | |
name: Output Annotations | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
if: always() | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ env.DEFAULT_PYTHON }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
cache: pip | |
cache-dependency-path: | | |
requirements.txt | |
requirements-dev.txt | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
if: always() | |
with: | |
path: reports | |
- name: Install mewbot-dev-tools | |
shell: bash | |
run: python -m pip install mewbot-dev-tools | |
- name: Output Annotations | |
shell: bash | |
run: python -m mewbot_dev_tools.annotate | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
if: always() | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
if: always() | |
with: | |
name: lint-results-${{ env.DEFAULT_OS }}-${{ env.DEFAULT_PYTHON }} | |
path: reports | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
if: always() | |
with: | |
name: test-results-${{ env.DEFAULT_OS }}-${{ env.DEFAULT_PYTHON }} | |
path: reports | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
if: always() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |