From 961a9f82455df706372714e01766577431821c35 Mon Sep 17 00:00:00 2001 From: Lily Wang <31115101+lilyminium@users.noreply.github.com> Date: Tue, 28 May 2024 07:13:13 +1000 Subject: [PATCH] Revert test matrix back to manual (#111) * check tests fail * update job name * reset name back to main-tests * rm dev * change python matrix to manual * is codecov the problem here? * dont fail ci for codecov * remove all dynamic python versions * add codecov token? * escape braces * ignore codecov failure? * upgrade act and allow codecov failure again * add more comment to CI * try changing the name of the package * Revert "try changing the name of the package" This reverts commit 57050d251dd005699e61e82a10ff8df1ce02e7da. * assert False * tmp list directory * downgrade act? * rm assert False * pass secret to act * add actions workaround for secret * try oidc? * give up and try editing file to ignore upload failure * Revert "rm assert False" This reverts commit 26017683c6eeea7524c0b8eaf0069a62ae91dc78. * Revert "Revert "rm assert False"" This reverts commit 51bdcff8b56db0a9e9bc742a2b0ef0970d982714. * Fix CI to fail and run appropriately (#116) * tmp let CI run without codecov * check directory exists * make package and repo name markedly different * tmp add assert False * fix env value? * fix path? * fix var name * add more listing * even more listing * am doofus * rm some temporary changes * add list back in * tmp try fixes to check ci * tmp simplify matrix * allow os * allow mdanalysis versions * use manual python matrix * Revert "tmp try fixes to check ci" This reverts commit 613debe92b7b6d828eef98f5cd091e8feeaf556b. * Revert "Revert "tmp try fixes to check ci"" This reverts commit 5133e40edfcda0e06e9ad03d5eb259f119894496. * Revert "Revert "Revert "tmp try fixes to check ci""" This reverts commit 38cf157a50882d34d17975e607c495b9295f2e94. * try v4 * bump act action? * upgrade versions * why isnt this running? * reorder os? * upgrade act all the way * its called act-latest now? * oops wrong place * add p=false * downgrade codecov back to v4, act back to 0.2.40, see how that goes * Revert "upgrade versions" This reverts commit 2ecd7b0fc1384ea3f2ce7626d05f4e00859b307c. --- .github/actions/run-cookie-ci/action.yaml | 7 ++- .github/workflows/gh-ci.yaml | 12 +++++- tests/test_output.py | 2 +- .../workflows/{{cookiecutter._ci_name}}.yaml | 43 +++++++++---------- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/.github/actions/run-cookie-ci/action.yaml b/.github/actions/run-cookie-ci/action.yaml index 532d9869..5c0cd6b4 100644 --- a/.github/actions/run-cookie-ci/action.yaml +++ b/.github/actions/run-cookie-ci/action.yaml @@ -20,6 +20,9 @@ inputs: description: email associated with GitHub user required: true default: github-action@users.noreply.github.com + CODECOV_TOKEN: + description: Codecov token + required: true runs: using: "composite" @@ -54,4 +57,6 @@ runs: shell: bash run: | docker images - act --job main-tests --platform ubuntu-latest=act-conda + sed -i -e 's/fail_ci_if_error: true/fail_ci_if_error: false/g' .github/workflows/gh-ci.yaml + cat .github/workflows/gh-ci.yaml + act --job main-tests --platform ubuntu-latest=act-conda -s CODECOV_TOKEN=${{ inputs.CODECOV_TOKEN }} -p=false diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index 68239a15..58517825 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -19,6 +19,7 @@ defaults: env: ARTIFACT_NAME: demo-mdakit-repos OUTPUT_DIRECTORY: /home/runner/example_outputs + OUTPUT_COOKIE_SUBDIRECTORY: TestMDAKit_with_host_MDAnalysis_condaforge-deps_and_ReadTheDocs/mdakit-cookie GH_USER: github-actions GH_EMAIL: "github-action@users.noreply.github.com" GH_REPOSITORY: "github.com/${{ github.repository }}.git" @@ -60,7 +61,7 @@ jobs: run: | # --keep-test-outputs also saves the generated repositories if [[ ${{ matrix.os }} == "ubuntu-latest" ]] ; then - PYTEST_FLAGS="--keep-test-outputs $OUTPUT_DIRECTORY" + PYTEST_FLAGS="--keep-test-outputs ${{ env.OUTPUT_DIRECTORY }}" else PYTEST_FLAGS="" fi @@ -68,11 +69,18 @@ jobs: pytest tests/ $PYTEST_FLAGS + - name: check cookie CI presence + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + ls -la ${{ env.OUTPUT_DIRECTORY }}/ + ls -la ${{ env.OUTPUT_DIRECTORY }}/${{ env.OUTPUT_COOKIE_SUBDIRECTORY }}/ + - name: Run cookie CI if: ${{ matrix.os == 'ubuntu-latest' }} uses: ./.github/actions/run-cookie-ci with: - source-directory: ${{ env.OUTPUT_DIRECTORY }}/TestMDAKit_with_host_MDAnalysis_condaforge-deps_and_ReadTheDocs/mdakit-cookie + source-directory: ${{ env.OUTPUT_DIRECTORY }}/${{ env.OUTPUT_COOKIE_SUBDIRECTORY }} + CODECOV_TOKEN: ${{ secrets.COOKIE_CODECOV_TOKEN }} - name: Upload artifact if: ${{ matrix.os == 'ubuntu-latest' && matrix.last-n-minor-python-release == 0 }} diff --git a/tests/test_output.py b/tests/test_output.py index 21a57910..21844bb1 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -60,7 +60,7 @@ def test_write_outputs( kitter = CookiecutterMDAKit( project_name=project_name, repo_name="mdakit-cookie", - package_name="mdakit_cookie", + package_name="cookiekit", github_username="test-user-account", github_host_account=github_host_account, description=description, diff --git a/{{cookiecutter.repo_name}}/.github/workflows/{{cookiecutter._ci_name}}.yaml b/{{cookiecutter.repo_name}}/.github/workflows/{{cookiecutter._ci_name}}.yaml index 1c7f8fe9..89fad07c 100644 --- a/{{cookiecutter.repo_name}}/.github/workflows/{{cookiecutter._ci_name}}.yaml +++ b/{{cookiecutter.repo_name}}/.github/workflows/{{cookiecutter._ci_name}}.yaml @@ -23,31 +23,21 @@ defaults: shell: bash {% if cookiecutter.__dependency_source != 'pip' %} -l {0} {% endif %} jobs: - environment-config: - runs-on: ubuntu-latest - outputs: - stable-python-version: {{ "${{ steps.get-compatible-python.outputs.stable-python }}" }} - python-matrix: {{ "${{ steps.get-compatible-python.outputs.python-versions }}" }} - steps: - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - id: get-compatible-python - uses: MDAnalysis/mdanalysis-compatible-python@main - with: - release: "latest" - main-tests: if: "github.repository == '{{ cookiecutter.github_host_account }}/{{ cookiecutter.repo_name }}'" - needs: environment-config runs-on: {{ '${{ matrix.os }}' }} strategy: fail-fast: false matrix: - os: [macOS-latest, ubuntu-latest, windows-latest] - python-version: {% raw %}${{ fromJSON(needs.environment-config.outputs.python-matrix) }}{% endraw %} + os: [ubuntu-latest, macOS-latest, windows-latest] mdanalysis-version: ["latest", "develop"] + python-version: ["3.10", "3.11", "3.12"] + exclude: + # Entries here exclude particular combinations of the matrix + # Edit or remove as particular combinations come into or out of date + # Below we exclude runs with the latest release and Python 3.12 + - mdanalysis-version: "latest" + python-version: "3.12" steps: - uses: actions/checkout@v4 @@ -123,11 +113,19 @@ jobs: file: coverage.xml name: codecov-{{ '${{ matrix.os }}' }}-py{{ '${{ matrix.python-version }}' }} verbose: True + # to upload coverage reports, set a secret called CODECOV_TOKEN + # in the repository settings + # (Obtain this from the Codecov website after setting up the repository there) + token: {{ '${{ secrets.CODECOV_TOKEN }}' }} + # To fail the CI if there's an error, keep this set to true + # If repository forks need to run CI, you may need to set this to false + # Forks can't access the CODECOV_TOKEN secret, + # and a failed upload registers as an error + fail_ci_if_error: true pylint_check: if: "github.repository == '{{ cookiecutter.github_host_account }}/{{ cookiecutter.repo_name }}'" - needs: environment-config runs-on: ubuntu-latest steps: @@ -136,7 +134,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: {{ '${{ needs.environment-config.outputs.stable-python-version }}' }} + python-version: "3.11" - name: Install Pylint run: | @@ -153,16 +151,15 @@ jobs: pypi_check: if: "github.repository == '{{ cookiecutter.github_host_account }}/{{ cookiecutter.repo_name }}'" - needs: environment-config runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python {{ '${{ needs.environment-config.outputs.stable-python-version }}' }} + - name: Set up Python uses: actions/setup-python@v4 with: - python-version: {{ '${{ needs.environment-config.outputs.stable-python-version }}' }} + python-version: "3.11" - name: Install dependencies run: |