From d47e6b70c5c1aa387a7fae6d77991f0083907e3f Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 7 Jun 2024 09:16:27 -0400 Subject: [PATCH 1/2] github actions CI maintainence - copy the download logic from RMG-Py (https://github.com/ReactionMechanismGenerator/RMG-Py/pull/2669) that updates the version of download-artifact - increment setup-miniconda --- .github/workflows/CI.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4fe555db31..0cf6df9a8a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -64,7 +64,7 @@ jobs: # configures the mamba environment manager and builds the environment - name: Setup Mambaforge Python 3.7 - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: environment-file: RMG-Py/environment.yml miniforge-variant: Mambaforge @@ -149,23 +149,24 @@ jobs: run: mkdir stable_regression_results # Retrieve Stable Results for reference - # Will need to use this -> https://github.com/dawidd6/action-download-artifact + - name : Find ID of Reference Results + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + run_id=$(gh run list -R ReactionMechanismGenerator/RMG-Py --workflow="Continuous Integration" --branch main --limit 1 --json databaseId --jq '.[0].databaseId') + echo "CI_RUN_ID=$run_id" >> $GITHUB_ENV + - name: Retrieve Stable Regression Results if: ${{ env.REFERENCE_JOB == 'false' }} - uses: dsnopek/action-download-artifact@91dda23aa09c68860977dd0ed11d93c0ed3795e7 # see https://github.com/ReactionMechanismGenerator/RMG-Py/pull/2459#issuecomment-1582850815 + uses: actions/download-artifact@v4 with: # this will search for the last successful execution of CI on main and download # the stable regression results - workflow: CI.yml - workflow_conclusion: success - repo: ReactionMechanismGenerator/RMG-Py - branch: main + run-id: ${{ env.CI_RUN_ID }} + repository: ReactionMechanismGenerator/RMG-Py + github-token: ${{ secrets.GH_PAT }} name: stable_regression_results - path: RMG-Py/stable_regression_results - search_artifacts: true # retrieves the last run result, either scheduled daily or on push to main - ensure_latest: true # ensures that the latest run is retrieved - # should result in a set of folders inside stable_regression_results - # each of which has the stable result for that example/test + path: stable_regression_results # Regression Testing - Actual Comparisons - name: Regression Tests - Compare to Baseline From a85e44c4963f7bf69eaba0c3a1a86a1769fc9334 Mon Sep 17 00:00:00 2001 From: Jackson Burns Date: Fri, 7 Jun 2024 09:28:55 -0400 Subject: [PATCH 2/2] set a default value for the conda_token if the secret is missing (forks) --- .github/workflows/conda_build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conda_build.yml b/.github/workflows/conda_build.yml index d528ee94c2..c1d447c38b 100644 --- a/.github/workflows/conda_build.yml +++ b/.github/workflows/conda_build.yml @@ -27,8 +27,10 @@ jobs: run: | conda config --set anaconda_upload yes - name: Build Binary - env: - CONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} run: | + # set a default value to the conda_token if needed (like from forks) + : "${CONDA_TOKEN:=${{ secrets.ANACONDA_TOKEN }}}" + : "${CONDA_TOKEN:=default_value}" + echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV conda config --add channels conda-forge conda-build --token $CONDA_TOKEN --user rmg .conda