From 598823ebe4732f72060c17c8d3ee42d2395cce93 Mon Sep 17 00:00:00 2001 From: Maximilian Schulz <83698606+maxschulz-COL@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:12:17 +0100 Subject: [PATCH] Adjust CI scripts for package specific tasks (#139) --- ...{lint-vizro-ai.yml => checks-vizro-ai.yml} | 20 ++++---- ...t-vizro-core.yml => checks-vizro-core.yml} | 11 +++-- .github/workflows/lint-vizro-all.yml | 47 ++++++++++++++++++ .../workflows/test-integration-vizro-ai.yml | 1 + ...31101_120705_maximilian_schulz_check_CI.md | 48 +++++++++++++++++++ vizro-ai/hatch.toml | 4 +- ...31101_120104_maximilian_schulz_check_CI.md | 48 +++++++++++++++++++ vizro-core/hatch.toml | 3 +- 8 files changed, 161 insertions(+), 21 deletions(-) rename .github/workflows/{lint-vizro-ai.yml => checks-vizro-ai.yml} (83%) rename .github/workflows/{lint-vizro-core.yml => checks-vizro-core.yml} (94%) create mode 100644 .github/workflows/lint-vizro-all.yml create mode 100644 vizro-ai/changelog.d/20231101_120705_maximilian_schulz_check_CI.md create mode 100644 vizro-core/changelog.d/20231101_120104_maximilian_schulz_check_CI.md diff --git a/.github/workflows/lint-vizro-ai.yml b/.github/workflows/checks-vizro-ai.yml similarity index 83% rename from .github/workflows/lint-vizro-ai.yml rename to .github/workflows/checks-vizro-ai.yml index 95ac9e1a2..09e7bc44b 100644 --- a/.github/workflows/lint-vizro-ai.yml +++ b/.github/workflows/checks-vizro-ai.yml @@ -1,4 +1,4 @@ -name: lint-vizro-ai +name: checks-vizro-ai defaults: run: working-directory: vizro-ai @@ -6,12 +6,16 @@ defaults: on: push: branches: [main] + paths: + - "vizro-ai/**" pull_request: branches: - "main" + paths: + - "vizro-ai/**" concurrency: - group: lint-${{ github.head_ref }} + group: checks-ai-${{ github.head_ref }} cancel-in-progress: true env: @@ -42,18 +46,12 @@ jobs: - name: List dependencies run: hatch run all.py${{ matrix.python-version }}:pip freeze - - name: Lint - run: hatch run all.py${{ matrix.python-version }}:lint - - name: Check requirements for Snyk are up to date - run: | - pwd - hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check + run: hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check - name: Find added changelog fragments id: added-files run: | - pwd if ${{ github.event_name == 'pull_request' }}; then echo "added_files=$(git diff --name-only --diff-filter=A -r HEAD^1 HEAD -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT else @@ -64,9 +62,9 @@ jobs: run: | if [ -z "${{ steps.added-files.outputs.added_files }}" ]; then - echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run docs:changelog' to create such a fragment."; + echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment."; echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user." - echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as." + echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is." exit 1 else echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!"; diff --git a/.github/workflows/lint-vizro-core.yml b/.github/workflows/checks-vizro-core.yml similarity index 94% rename from .github/workflows/lint-vizro-core.yml rename to .github/workflows/checks-vizro-core.yml index 76754e2cc..dee429588 100644 --- a/.github/workflows/lint-vizro-core.yml +++ b/.github/workflows/checks-vizro-core.yml @@ -1,4 +1,4 @@ -name: lint-vizro-core +name: checks-vizro-core defaults: run: @@ -7,12 +7,16 @@ defaults: on: push: branches: [main] + paths: + - "vizro-core/**" pull_request: branches: - "main" + paths: + - "vizro-core/**" concurrency: - group: lint-${{ github.head_ref }} + group: checks-core-${{ github.head_ref }} cancel-in-progress: true env: @@ -43,9 +47,6 @@ jobs: - name: List dependencies run: hatch run all.py${{ matrix.python-version }}:pip freeze - - name: Lint - run: hatch run all.py${{ matrix.python-version }}:lint - - name: Check schema is up to date run: hatch run all.py${{ matrix.python-version }}:schema --check diff --git a/.github/workflows/lint-vizro-all.yml b/.github/workflows/lint-vizro-all.yml new file mode 100644 index 000000000..ea820acd9 --- /dev/null +++ b/.github/workflows/lint-vizro-all.yml @@ -0,0 +1,47 @@ +name: lint-vizro-all + +defaults: + run: + working-directory: vizro-core # but could be any folder + +on: + push: + branches: [main] + pull_request: + branches: + - "main" + +concurrency: + group: lint-${{ github.head_ref }} + cancel-in-progress: true + +env: + PYTHONUNBUFFERED: "1" + FORCE_COLOR: "1" + +jobs: + run: + name: Python ${{ matrix.python-version }} on Linux + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8"] + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Hatch + run: pip install --upgrade hatch + + - name: List dependencies + run: hatch run all.py${{ matrix.python-version }}:pip freeze + + - name: Lint + run: hatch run all.py${{ matrix.python-version }}:lint diff --git a/.github/workflows/test-integration-vizro-ai.yml b/.github/workflows/test-integration-vizro-ai.yml index 8ad161d63..4671d1d37 100644 --- a/.github/workflows/test-integration-vizro-ai.yml +++ b/.github/workflows/test-integration-vizro-ai.yml @@ -4,6 +4,7 @@ # run: # working-directory: vizro-core # +##### TODO: adjust below according to other scripts #on: # # push: # # branches: [main] diff --git a/vizro-ai/changelog.d/20231101_120705_maximilian_schulz_check_CI.md b/vizro-ai/changelog.d/20231101_120705_maximilian_schulz_check_CI.md new file mode 100644 index 000000000..f1f65e73c --- /dev/null +++ b/vizro-ai/changelog.d/20231101_120705_maximilian_schulz_check_CI.md @@ -0,0 +1,48 @@ +<!-- +A new scriv changelog fragment. + +Uncomment the section that is right (remove the HTML comment wrapper). +--> + +<!-- +### Highlights ✨ + +- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Removed + +- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Added + +- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Changed + +- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Deprecated + +- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Fixed + +- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Security + +- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> diff --git a/vizro-ai/hatch.toml b/vizro-ai/hatch.toml index 5ec9d761c..65a6479ff 100644 --- a/vizro-ai/hatch.toml +++ b/vizro-ai/hatch.toml @@ -59,9 +59,7 @@ dependencies = [ "mkdocstrings[python]" ] detached = true - -[envs.docs.scripts] -serve = "mkdocs serve" +scripts = {serve = "mkdocs serve"} [version] path = "src/vizro_ai/__init__.py" diff --git a/vizro-core/changelog.d/20231101_120104_maximilian_schulz_check_CI.md b/vizro-core/changelog.d/20231101_120104_maximilian_schulz_check_CI.md new file mode 100644 index 000000000..f1f65e73c --- /dev/null +++ b/vizro-core/changelog.d/20231101_120104_maximilian_schulz_check_CI.md @@ -0,0 +1,48 @@ +<!-- +A new scriv changelog fragment. + +Uncomment the section that is right (remove the HTML comment wrapper). +--> + +<!-- +### Highlights ✨ + +- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Removed + +- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Added + +- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Changed + +- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Deprecated + +- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Fixed + +- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> +<!-- +### Security + +- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1)) + +--> diff --git a/vizro-core/hatch.toml b/vizro-core/hatch.toml index c2c7b0350..bb9d66cc7 100644 --- a/vizro-core/hatch.toml +++ b/vizro-core/hatch.toml @@ -75,8 +75,7 @@ dependencies = [ "mkdocs", "mkdocs-material", "mkdocs-git-revision-date-localized-plugin", - "mkdocstrings[python]", - "scriv" + "mkdocstrings[python]" ] detached = true scripts = {serve = "mkdocs serve"}