From d4a7ac024baa0da085c57c519cbffbf424517d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= Date: Fri, 1 Nov 2024 10:14:57 -0400 Subject: [PATCH 1/3] set default stages for pre-commit so that the same hooks do not run several times upon commit --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e0f4bc35f..f8427df743 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,8 @@ default_language_version: python: python3 +default_stages: [pre-commit,pre-push] +fail_fast: false + repos: - repo: https://github.com/psf/black-pre-commit-mirror rev: 24.3.0 From 1c9a65376b68ec7b5baf60b7140ecfb2803d8d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= Date: Fri, 1 Nov 2024 10:15:39 -0400 Subject: [PATCH 2/3] add concurrency conditions to github publish workflows --- .github/workflows/python_deploy_dev.yml | 4 ++++ .github/workflows/python_deploy_prod.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/python_deploy_dev.yml b/.github/workflows/python_deploy_dev.yml index 34d0b38e22..6d8a87cf96 100644 --- a/.github/workflows/python_deploy_dev.yml +++ b/.github/workflows/python_deploy_dev.yml @@ -5,6 +5,10 @@ on: tags: - 'v*' # Push events to every version tag (eg. v1.0.0) +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: call-workflow-conda-publish: name: Publish development conda package on JFrog Artifactory diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index 47d9b9b3cd..723f73b326 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -4,6 +4,10 @@ on: release: types: [published] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: call-workflow-conda-publish: name: Publish production conda package on JFrog Artifactory From e50c6aea48a9409046725f396cac9490c0be1ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Hensgen?= Date: Fri, 15 Nov 2024 17:54:37 -0500 Subject: [PATCH 3/3] use new publish workflows --- .github/workflows/python_deploy_dev.yml | 4 +-- .github/workflows/python_deploy_prod.yml | 36 ++++++++++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/python_deploy_dev.yml b/.github/workflows/python_deploy_dev.yml index 6d8a87cf96..ab1ae5843e 100644 --- a/.github/workflows/python_deploy_dev.yml +++ b/.github/workflows/python_deploy_dev.yml @@ -6,7 +6,7 @@ on: - 'v*' # Push events to every version tag (eg. v1.0.0) concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: true jobs: @@ -16,7 +16,7 @@ jobs: with: package-name: 'mira-simpeg' python-version: '3.10' - virtual-repo-nameS: '["public-conda-dev"]' + virtual-repo-names: '["public-conda-dev"]' secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} diff --git a/.github/workflows/python_deploy_prod.yml b/.github/workflows/python_deploy_prod.yml index 723f73b326..b5d2853e52 100644 --- a/.github/workflows/python_deploy_prod.yml +++ b/.github/workflows/python_deploy_prod.yml @@ -3,31 +3,43 @@ name: Deploy python package in production on: release: types: [published] + workflow_dispatch: + inputs: + release-tag: + description: 'Tag for the existing (draft) release to publish assets from' + required: true + publish-conda: + description: 'Publish Conda package' + required: false + default: true + publish-pypi: + description: 'Publish PyPI package' + required: false + default: true concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.event.release.tag_name || github.event.inputs.release-tag || github.run_id }} cancel-in-progress: true jobs: - call-workflow-conda-publish: - name: Publish production conda package on JFrog Artifactory - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_conda_package.yml@main + call-workflow-conda-release: + name: Publish production Conda package on JFrog Artifactory + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@main + if: ${{ github.event_name == 'release' || github.event.inputs.publish-conda == 'true' }} with: - package-name: 'mira-simpeg' - python-version: '3.10' virtual-repo-names: '["public-conda-prod"]' + release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }} - call-workflow-pypi-publish: - name: Publish production pypi package (JFrog Artifactory and PyPI) - uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-publish_pypi_package.yml@main + call-workflow-pypi-release: + name: Publish production PyPI package (JFrog Artifactory and PyPI) + if: ${{ github.event_name == 'release' || github.event.inputs.publish-pypi == 'true' }} + uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_pypi_assets.yml@main with: - package-manager: 'setuptools' package-name: 'mira-simpeg' - version-tag: ${{ github.ref_name }} - python-version: '3.10' virtual-repo-names: '["public-pypi-prod", "pypi"]' + release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }} secrets: JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }} JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}