Merge branch 'main' into 20230824_merge_dcl10 #237
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: pre-commit | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] | |
name: Pre-commit python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
mypy-requirements.txt | |
dev-requirements.txt | |
architecture: x64 | |
- name: 'Install requirements (standard)' | |
if: ${{ matrix.python-version != '3.6' }} | |
run: | | |
pip install --upgrade pip wheel | |
pip install -r requirements.txt | |
- name: 'Install requirements (custom Python ${{ matrix.python-version }})' | |
if: ${{ matrix.python-version == '3.6' }} | |
run: | | |
pip install wheel | |
pip install -r requirements.txt -r requirements-additional-${{ matrix.python-version }}.txt | |
- name: 'Freeze Python ${{ matrix.python-version }} constraints' | |
run: | | |
pip freeze > constraints-${{ matrix.python-version }}.txt | |
- run: pip install -r dev-requirements.txt -r mypy-requirements.txt | |
- name: MyPy cache | |
uses: actions/cache@v3 | |
with: | |
path: .mypy_cache/${{ matrix.python-version }} | |
key: mypy-${{ matrix.python-version }} | |
- name: 'pre-commit' | |
uses: pre-commit/action@v3.0.0 | |
# if: ${{ matrix.python-version != '3.6' }} | |
with: | |
extra_args: --all -c .pre-commit-config.yaml | |
# - name: 'pre-commit (custom Python ${{ matrix.python-version }})' | |
# uses: pre-commit/action@v3.0.0 | |
# if: ${{ matrix.python-version == '3.6' }} | |
# with: | |
# extra_args: --all -c .pre-commit-config-gh-${{ matrix.python-version }}.yaml | |
- name: Check transitive dependencies licences | |
id: license_check_report | |
# uses: pilosus/action-pip-license-checker@v1.0.0 | |
# continue-on-error: true | |
uses: pilosus/action-pip-license-checker@v2.0.0 | |
with: | |
requirements: constraints-${{ matrix.python-version }}.txt | |
fail: 'StrongCopyleft' | |
exclude: 'pylint.*' | |
- name: Print licences report | |
if: ${{ always() }} | |
run: echo "${{ steps.license_check_report.outputs.report }}" | |
- uses: actions/upload-artifact@v3 | |
with: | |
retention-days: 2 | |
path: constraints-${{ matrix.python-version }}.txt | |
pull_request_changes: | |
runs-on: ubuntu-latest | |
name: Pull request with the newly generated contents | |
needs: | |
- pre-commit | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
path: changes-dir | |
- name: Move artifacts to their right place | |
run: | | |
cp -dpr changes-dir/artifact/* . | |
rm -r changes-dir/artifact | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Updated constraints (triggered by ${{ github.sha }}) | |
branch: create-pull-request/patch-constraints | |
delete-branch: true | |
commit-message: "[create-pull-request] Automatically commit updated contents (constraints)" | |
- name: Check outputs | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |