From 3830a8310e03202ea688831b599bfa1e9558efc4 Mon Sep 17 00:00:00 2001 From: Samuel Larkin Date: Thu, 29 Aug 2024 13:20:02 -0400 Subject: [PATCH] feat(ci): Merged pre-commit into test workflow (#529) A BIG thanks to @joanise for helping solving the mystery of `conda-incubator/setup-miniconda` and `pre-commit/action`. --- .github/workflows/pre-commit.yml | 32 -------------------------------- .github/workflows/test.yml | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index e4bfc4e9..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,32 +0,0 @@ -# [install the GitHub Application on the relevant repositories](https://github.com/apps/pre-commit-ci-lite/installations/new) -name: Run pre-commit.ci lite - -on: - pull_request: - push: - branches: [main] - -jobs: - main: - # note: the step must have either the default name or contain the text - # pre-commit-ci-lite. the application uses this to find the right workflow. - # [pre-commit.ci lite](https://pre-commit.ci/lite.html) - name: pre-commit-ci-lite - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - run: pip install -r requirements.dev.txt - - run: pip install -e . - - run: pip list - - uses: tj-actions/changed-files@v36 - id: file_changes - - uses: pre-commit/action@v3.0.1 - with: - extra_args: --files ${{ steps.file_changes.outputs.all_changed_files }} - - uses: pre-commit-ci/lite-action@v1.0.2 - if: always() diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f16a429..83ccb9bd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,8 @@ jobs: pull-requests: write defaults: run: + # Required for conda-incubator/setup-miniconda + # https://github.com/conda-incubator/setup-miniconda?tab=readme-ov-file#important shell: bash -l {0} steps: - name: Checkout repository and submodules @@ -31,17 +33,23 @@ jobs: - name: Install dependencies and package run: | CUDA_TAG=cpu pip install -r requirements.torch.txt --find-links https://download.pytorch.org/whl/torch_stable.html - pip install -r requirements.test.txt + pip install -r requirements.dev.txt pip install cython pip install -e . pip install coverage - - name: Log complete list of packages - run: | - pip freeze + - run: pip freeze + - run: pip list - name: Check licenses run: | pip install pip-licenses if pip-licenses | grep -E -v 'Artistic License|LGPL|Public Domain' | grep GNU; then echo 'Please avoid introducing *GPL dependencies'; false; fi + - uses: tj-actions/changed-files@v45 + id: file_changes + - name: Custom replacement for pre-commit/action + # pre-commit/action is not compatible with conda-incubator/setup-miniconda because it sets the shell wrong. + run: python -m pre_commit run --show-diff-on-failure --color=always --files ${{ steps.file_changes.outputs.all_changed_files }} + - uses: pre-commit-ci/lite-action@v1.0.2 + if: always() - name: Run tests run: | cd everyvoice && coverage run run_tests.py dev