attempt to run pre-commit in own action w/ burnettk jbirddog
This commit is contained in:
parent
a9e9cf8bd9
commit
875a3a0bfc
|
@ -16,7 +16,6 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
|
|
||||||
- { python: "3.11", os: "ubuntu-latest", session: "safety" }
|
- { python: "3.11", os: "ubuntu-latest", session: "safety" }
|
||||||
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
|
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
|
||||||
- {
|
- {
|
||||||
|
@ -97,29 +96,29 @@ jobs:
|
||||||
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
|
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
|
||||||
nox --version
|
nox --version
|
||||||
|
|
||||||
- name: Compute pre-commit cache key
|
# - name: Compute pre-commit cache key
|
||||||
if: matrix.session == 'pre-commit'
|
# if: matrix.session == 'pre-commit'
|
||||||
id: pre-commit-cache
|
# id: pre-commit-cache
|
||||||
shell: python
|
# shell: python
|
||||||
run: |
|
# run: |
|
||||||
import hashlib
|
# import hashlib
|
||||||
import sys
|
# import sys
|
||||||
|
#
|
||||||
python = "py{}.{}".format(*sys.version_info[:2])
|
# python = "py{}.{}".format(*sys.version_info[:2])
|
||||||
payload = sys.version.encode() + sys.executable.encode()
|
# payload = sys.version.encode() + sys.executable.encode()
|
||||||
digest = hashlib.sha256(payload).hexdigest()
|
# digest = hashlib.sha256(payload).hexdigest()
|
||||||
result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
|
# result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8])
|
||||||
|
#
|
||||||
print("::set-output name=result::{}".format(result))
|
# print("::set-output name=result::{}".format(result))
|
||||||
|
#
|
||||||
- name: Restore pre-commit cache
|
# - name: Restore pre-commit cache
|
||||||
uses: actions/cache@v3.0.11
|
# uses: actions/cache@v3.0.11
|
||||||
if: matrix.session == 'pre-commit'
|
# if: matrix.session == 'pre-commit'
|
||||||
with:
|
# with:
|
||||||
path: ~/.cache/pre-commit
|
# path: ~/.cache/pre-commit
|
||||||
key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
# key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||||
restore-keys: |
|
# restore-keys: |
|
||||||
${{ steps.pre-commit-cache.outputs.result }}-
|
# ${{ steps.pre-commit-cache.outputs.result }}-
|
||||||
- name: Setup Mysql
|
- name: Setup Mysql
|
||||||
uses: mirromutth/mysql-action@v1.1
|
uses: mirromutth/mysql-action@v1.1
|
||||||
with:
|
with:
|
||||||
|
@ -160,6 +159,35 @@ jobs:
|
||||||
name: logs-${{matrix.python}}-${{matrix.os}}-${{matrix.database}}
|
name: logs-${{matrix.python}}-${{matrix.os}}-${{matrix.database}}
|
||||||
path: "./log/*.log"
|
path: "./log/*.log"
|
||||||
|
|
||||||
|
run_pre_commit_checks:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out the repository
|
||||||
|
uses: actions/checkout@v3.0.2
|
||||||
|
with:
|
||||||
|
# Disabling shallow clone is recommended for improving relevancy of reporting in sonarcloud
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4.2.0
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
- name: Upgrade pip
|
||||||
|
working-directory: .
|
||||||
|
run: |
|
||||||
|
pip install --constraint=.github/workflows/constraints.txt pip
|
||||||
|
pip --version
|
||||||
|
- name: Install Poetry
|
||||||
|
working-directory: .
|
||||||
|
run: |
|
||||||
|
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
|
||||||
|
poetry --version
|
||||||
|
- name: Poetry Install
|
||||||
|
run: poetry install
|
||||||
|
working-directory: .
|
||||||
|
- name: run_pre_commit
|
||||||
|
run: ./bin/run_pre_commit_in_ci
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
check_docker_start_script:
|
check_docker_start_script:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function error_handler() {
|
||||||
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
||||||
|
exit "$2"
|
||||||
|
}
|
||||||
|
trap 'error_handler ${LINENO} $?' ERR
|
||||||
|
set -o errtrace -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
poetry run pre-commit run --verbose --all-files
|
Loading…
Reference in New Issue