From b8513423f38b977fb468d9a9e96e0d50c15c815e Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Thu, 7 Dec 2023 16:26:27 +0100 Subject: [PATCH 1/5] Only test on Ubuntu --- .github/workflows/test-env.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-env.yaml b/.github/workflows/test-env.yaml index f80dc60..c27f4a2 100644 --- a/.github/workflows/test-env.yaml +++ b/.github/workflows/test-env.yaml @@ -14,15 +14,14 @@ jobs: fail-fast: false matrix: # os: ["ubuntu-latest", "macos-latest", "windows-latest"] # Openslide not available via conda on Windows - os: ["ubuntu-latest", "macos-latest"] + os: ["ubuntu-latest"] steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: test + activate-environment: anaconda-client-env environment-file: environment.yaml auto-activate-base: false - - shell: bash -l {0} - run: | + - run: | conda info conda list From 815baffcefd554da0c11cafb02a022218f6960fe Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Thu, 7 Dec 2023 16:29:46 +0100 Subject: [PATCH 2/5] Use only one pre-commit config --- .github/workflows/code-quality-main.yaml | 24 --------------- .github/workflows/code-quality-pr.yaml | 38 ------------------------ .github/workflows/pre-commit.yaml | 20 +++++++++++++ 3 files changed, 20 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/code-quality-main.yaml delete mode 100644 .github/workflows/code-quality-pr.yaml create mode 100644 .github/workflows/pre-commit.yaml diff --git a/.github/workflows/code-quality-main.yaml b/.github/workflows/code-quality-main.yaml deleted file mode 100644 index 47cfbcd..0000000 --- a/.github/workflows/code-quality-main.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# Same as `code-quality-pr.yaml` but triggered on commit to main branch -# and runs on all files (instead of only the changed ones) - -name: Code Quality Main - -on: - push: - branches: [main] - -jobs: - code-quality: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Run pre-commits - uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/code-quality-pr.yaml b/.github/workflows/code-quality-pr.yaml deleted file mode 100644 index 7f65b89..0000000 --- a/.github/workflows/code-quality-pr.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# This workflow finds which files were changed, prints them, -# and runs `pre-commit` on those files. - -# Inspired by the sktime library: -# https://github.com/alan-turing-institute/sktime/blob/main/.github/workflows/test.yml - -name: Code Quality PR - -on: - pull_request: - branches: [main, "release/*", "dev"] - -jobs: - code-quality: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Find modified files - id: file_changes - uses: trilom/file-changes-action@v1.2.4 - with: - output: " " - - - name: List modified files - run: echo '${{ steps.file_changes.outputs.files}}' - - - name: Run pre-commits - uses: pre-commit/action@v2.0.3 - with: - extra_args: --files ${{ steps.file_changes.outputs.files}} diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..0e1555a --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,20 @@ +# Use one pre-commit config +# Further information at https://github.com/pre-commit/action + +name: Code Quality + +on: + pull_request: + branches: [main, "release/*", "dev"] + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - uses: pre-commit/action@v3.0.0 From 441ed58aadd33c6d0eb5d9336d17c17d6f20a43d Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Thu, 7 Dec 2023 16:33:31 +0100 Subject: [PATCH 3/5] Adjust miniconda test --- .github/workflows/test-env.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-env.yaml b/.github/workflows/test-env.yaml index c27f4a2..39a3528 100644 --- a/.github/workflows/test-env.yaml +++ b/.github/workflows/test-env.yaml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: anaconda-client-env + activate-environment: test environment-file: environment.yaml auto-activate-base: false - run: | From cd82105adea99d198e7073a491317bc8b5ca63a8 Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Thu, 7 Dec 2023 16:37:35 +0100 Subject: [PATCH 4/5] Need to adjust shell in tests --- .github/workflows/test-env.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-env.yaml b/.github/workflows/test-env.yaml index 39a3528..08701d4 100644 --- a/.github/workflows/test-env.yaml +++ b/.github/workflows/test-env.yaml @@ -15,11 +15,14 @@ jobs: matrix: # os: ["ubuntu-latest", "macos-latest", "windows-latest"] # Openslide not available via conda on Windows os: ["ubuntu-latest"] + defaults: + run: + shell: bash -el {0} steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3 with: - activate-environment: test + activate-environment: anaconda-client-env environment-file: environment.yaml auto-activate-base: false - run: | From c9355f48805ca7ba6d1ef2a92de32e8ae83a317b Mon Sep 17 00:00:00 2001 From: Alexander Kurz Date: Thu, 7 Dec 2023 16:43:23 +0100 Subject: [PATCH 5/5] Add comments --- .github/workflows/test-env.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-env.yaml b/.github/workflows/test-env.yaml index 08701d4..f7bbd35 100644 --- a/.github/workflows/test-env.yaml +++ b/.github/workflows/test-env.yaml @@ -1,3 +1,7 @@ +# Helpful resources: +# 1.) https://autobencoder.com/2020-08-24-conda-actions/ +# 2.) https://github.com/conda-incubator/setup-miniconda + name: Test Env on: @@ -17,7 +21,7 @@ jobs: os: ["ubuntu-latest"] defaults: run: - shell: bash -el {0} + shell: bash -el {0} # Need to adjust shell to remember profile steps: - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v3