From 2b7844e1e4379e57784e4fb957fd9968950be0f9 Mon Sep 17 00:00:00 2001 From: Jirka Date: Sat, 24 Dec 2022 06:43:30 +0100 Subject: [PATCH 1/4] reuse + ref --- .github/workflows/check-code.yml | 18 ++++++++++++++---- .github/workflows/check-schema.yml | 2 +- .github/workflows/ci-testing.yml | 4 ++-- .github/workflows/ci-use-checks.yml | 2 ++ .github/workflows/docs-deploy.yml | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 87e9d217..8c8735d4 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -3,6 +3,10 @@ name: Check formating flow on: workflow_call: inputs: + actions-ref: + description: 'Version of actions, normally the same as workflow' + required: true + type: string python-version: description: 'Python version to use' default: '3.9' @@ -27,10 +31,16 @@ jobs: pip install mypy types-setuptools # don't use --upgrade to respect the version installed via setup.py pip list - # TODO: re-enable after the external usage is resolved, see #51 - # - uses: ./.github/actions/pip-list - # with: - # unfold: true + - name: Pull re-usable 🤖 actions️ + uses: actions/checkout@v3 + with: + ref: ${{ inputs.actions-ref }} + path: .cicd + repository: Lightning-AI/utilities + - name: Print 🖨️ dependencies + uses: ./.cicd/.github/actions/pip-list + with: + unfold: true - name: Check typing # mypy uses the config file found in the following order: diff --git a/.github/workflows/check-schema.yml b/.github/workflows/check-schema.yml index 98c9ca53..3bebf89d 100644 --- a/.github/workflows/check-schema.yml +++ b/.github/workflows/check-schema.yml @@ -5,7 +5,7 @@ on: inputs: azure-dir: description: 'Directory containing Azure Pipelines config files. Provide an empty string to skip checking on Azure Pipelines files.' - default: './.azure/' + default: '.azure/' required: false type: string diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 80fca35b..b0726d13 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -47,8 +47,8 @@ jobs: pip --version pip list - # TODO: re-enable after the external usage is resolved, see #51 - # - uses: ./.github/actions/pip-list + - name: Print 🖨️ dependencies + uses: ./.github/actions/pip-list - name: Unittesting and coverage uses: ./.github/actions/unittesting diff --git a/.github/workflows/ci-use-checks.yml b/.github/workflows/ci-use-checks.yml index 7aeb2adf..1d9e91d4 100644 --- a/.github/workflows/ci-use-checks.yml +++ b/.github/workflows/ci-use-checks.yml @@ -13,6 +13,8 @@ concurrency: jobs: check-code: uses: ./.github/workflows/check-code.yml + with: + actions-ref: ${{ github.sha }} # use local version check-schema: uses: ./.github/workflows/check-schema.yml diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 38ebe485..424717bf 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -40,8 +40,8 @@ jobs: pip list shell: bash - # TODO: re-enable after the external usage is resolved, see #51 - # - uses: ./.github/actions/pip-list + - name: Print 🖨️ dependencies + uses: ./.github/actions/pip-list - name: Make Documentation run: | From 2bbfe801f0a6f2ddd136d542d09a349783c7e32f Mon Sep 17 00:00:00 2001 From: Jirka Date: Sat, 24 Dec 2022 07:30:41 +0100 Subject: [PATCH 2/4] readme --- ...edule-clear-cache.yml => cron-clear-cache.yml} | 0 .../{docs-deploy.yml => deploy-docs.yml} | 0 README.md | 15 ++++++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) rename .github/workflows/{schedule-clear-cache.yml => cron-clear-cache.yml} (100%) rename .github/workflows/{docs-deploy.yml => deploy-docs.yml} (100%) diff --git a/.github/workflows/schedule-clear-cache.yml b/.github/workflows/cron-clear-cache.yml similarity index 100% rename from .github/workflows/schedule-clear-cache.yml rename to .github/workflows/cron-clear-cache.yml diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/deploy-docs.yml similarity index 100% rename from .github/workflows/docs-deploy.yml rename to .github/workflows/deploy-docs.yml diff --git a/README.md b/README.md index 4ca38b67..59db19ed 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,19 @@ name: Check schema on: [push] jobs: + check-schema: - uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@main + uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.5.0 + with: + azure-dir: "" # skip Azure check + + check-code: + uses: Lightning-AI/utilities//.github/workflows/check-code.yml@main with: - azure-dir: "" + actions-ref: main # normally you shall use the same version as the workflow ``` -See usage of other workflows in [.github/workflows/ci_use-checks.yml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci_use-checks.yml). +See usage of other workflows in [.github/workflows/ci-use-checks.yml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci-use-checks.yml). ## 2. Reusable composite actions @@ -52,8 +58,7 @@ jobs: - uses: Lightning-AI/utilities/.github/actions/cache with: python-version: 3.9 - requires: oldest - # requires: latest + requires: oldest # or latest ``` ## 3. CLI `lightning_utilities.cli` From 64eaa0dc67c77410792a2a0d4e637db431ce9de2 Mon Sep 17 00:00:00 2001 From: Jirka Date: Sat, 24 Dec 2022 07:33:40 +0100 Subject: [PATCH 3/4] chlog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52112ff3..8baaafef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Apply local actions in re-usable workflows ([#51](https://github.com/Lightning-AI/utilities/pull/51)) + ### Fixed From 768917e6a55579853779dc0cc67bd72533a976a5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 24 Dec 2022 06:33:56 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8baaafef..70d369b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Apply local actions in re-usable workflows ([#51](https://github.com/Lightning-AI/utilities/pull/51)) +- Apply local actions in re-usable workflows ([#51](https://github.com/Lightning-AI/utilities/pull/51)) ### Fixed