From c27088011f7cf7406c1c31618086e47be5fa0f33 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 16 May 2023 09:53:17 +0200 Subject: [PATCH] attempt at adding hooks --- .github/workflows/pre-commit-post-merge.yml | 19 +++++++++++++++++++ .pre-commit-config.yaml | 12 ++++++++++++ .../.github/workflows/test-install.yml | 12 +++++++----- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/pre-commit-post-merge.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit-post-merge.yml b/.github/workflows/pre-commit-post-merge.yml new file mode 100644 index 0000000..fdc6670 --- /dev/null +++ b/.github/workflows/pre-commit-post-merge.yml @@ -0,0 +1,19 @@ +name: Use pre-commit post merge + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [main] + +jobs: + pre-commit-post-merge: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - uses: pre-commit/action@v3.0.0 + - uses: pre-commit-ci/lite-action@v1.0.1 + if: always() diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8778eff --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.2.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 22.8.0 + hooks: + - id: black + exclude: ^docs/ diff --git a/{{cookiecutter.repo_name}}/.github/workflows/test-install.yml b/{{cookiecutter.repo_name}}/.github/workflows/test-install.yml index b27ec94..d18b3cd 100644 --- a/{{cookiecutter.repo_name}}/.github/workflows/test-install.yml +++ b/{{cookiecutter.repo_name}}/.github/workflows/test-install.yml @@ -1,23 +1,25 @@ name: Installation on: + workflow_dispatch: schedule: - cron: "0 0 1 * *" # First day of the month jobs: run: - name: Installation on (${{ matrix.os }}) + name: Installation on (${{ matrix.os }} with Python ${{ matrix.python-version }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: ["ubuntu-latest", "macos-latest", "windows-latest"] + python-version: ["3.8", "3.9", "3.10"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: git fetch --prune --unshallow --tags - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: ${{ matrix.python-version }} - name: Install pip run: | python -m pip install --upgrade pip @@ -27,4 +29,4 @@ jobs: - name: Test module load uses: jannekem/run-python-script-action@v1 with: - script: import {{cookiecutter.repo_name_slug}} + script: import {{cookiecutter.repo_name_slug}} \ No newline at end of file