From 53d79995f7d8798a029e301e69ebb339895a27e0 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 11:42:45 -0500 Subject: [PATCH 1/8] CI #263 add pre-commit --- .github/workflows/pre-commit.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..14a635d0 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,21 @@ +name: pre-commit + +# from: https://github.com/NSLS-II/scientific-python-cookiecutter/ ... /.github/workflows/pre-commit.yml + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + pre-commit: + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files From 3b9853f51a10df12b3da77c1dc2b4a1db84ba4c7 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 11:44:12 -0500 Subject: [PATCH 2/8] CI #263 make job names unique --- .github/workflows/conda_unit_test.yml | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/conda_unit_test.yml b/.github/workflows/conda_unit_test.yml index 2940d55e..30ed2e60 100644 --- a/.github/workflows/conda_unit_test.yml +++ b/.github/workflows/conda_unit_test.yml @@ -16,35 +16,35 @@ defaults: jobs: - lint: - name: Code style - runs-on: ubuntu-latest + # lint: + # name: Code style + # runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 + # steps: + # - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: '3.11' + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.11' - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 + # - name: Install Dependencies + # run: | + # python -m pip install --upgrade pip + # pip install flake8 - - name: Run flake8 - run: | - flake8 + # - name: Run flake8 + # run: | + # flake8 - - name: Run black - uses: rickstaa/action-black@v1 - with: - black_args: ". --check" + # - name: Run black + # uses: rickstaa/action-black@v1 + # with: + # black_args: ". --check" - build: + testing: runs-on: ubuntu-latest - needs: lint + # needs: lint strategy: matrix: python-version: From 58d9281050f13e245f797c7bbb8277e71ca02174 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 12:18:12 -0500 Subject: [PATCH 3/8] CI #263 add config file --- .pre-commit-config.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c8a22808 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-added-large-files + - id: check-ast + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: check-json + - id: debug-statements + - id: check-executables-have-shebangs + - id: mixed-line-ending + # - id: end-of-file-fixer + # - id: trailing-whitespace + +# - repo: https://github.com/pycqa/flake8 +# rev: 4.0.1 +# hooks: +# - id: flake8 + +# - repo: https://github.com/timothycrosley/isort +# rev: 5.12.0 +# hooks: +# - id: isort + +# - repo: https://github.com/psf/black +# rev: 22.8.0 +# hooks: +# - id: black From d900e151b07e232724dbf673becf2b2725a1d6c7 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 12:21:10 -0500 Subject: [PATCH 4/8] CI #263 force to run here --- .github/workflows/pre-commit.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 14a635d0..4f425975 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,8 +3,12 @@ name: pre-commit # from: https://github.com/NSLS-II/scientific-python-cookiecutter/ ... /.github/workflows/pre-commit.yml on: - pull_request: push: + branches: + - main + pull_request: + branches: + - main workflow_dispatch: jobs: From fb61be59c0e3bc4188a7da05c0993e49bdc235c6 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 12:22:15 -0500 Subject: [PATCH 5/8] CI #263 try another way --- .github/workflows/pre-commit.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 4f425975..cb1b4b69 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,18 +3,14 @@ name: pre-commit # from: https://github.com/NSLS-II/scientific-python-cookiecutter/ ... /.github/workflows/pre-commit.yml on: - push: - branches: - - main pull_request: - branches: - - main + push: workflow_dispatch: jobs: pre-commit: - # pull requests are a duplicate of a branch push if within the same repo. - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + # # pull requests are a duplicate of a branch push if within the same repo. + # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: From 7f51dae4f9036ab80145e5ae73f6d734e45c47f6 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 12:33:43 -0500 Subject: [PATCH 6/8] CI #263 pre-commit tests with py311 --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8a22808..f834c59f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,9 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks +ci: + default_language_version: python3.11 + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 From b3450c2fb11caba746bb63f7aa7a83bbe42a271d Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 17 Oct 2023 12:44:57 -0500 Subject: [PATCH 7/8] CI #263 restore conditional --- .github/workflows/pre-commit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index cb1b4b69..14a635d0 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -9,8 +9,8 @@ on: jobs: pre-commit: - # # pull requests are a duplicate of a branch push if within the same repo. - # if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository + # pull requests are a duplicate of a branch push if within the same repo. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: From 786426466a72d16b985c0bc84455599471199f39 Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Wed, 18 Oct 2023 20:16:20 -0500 Subject: [PATCH 8/8] Update .github/workflows/pre-commit.yml Co-authored-by: Max Rakitin --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 14a635d0..5ce7865d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - uses: pre-commit/action@v3.0.0 with: