From c563377f879d744c19511fd4b74c7fe1f0724a47 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:15:09 -0400 Subject: [PATCH 01/22] WIP - integrate energy measurements --- .github/workflows/main.yml | 131 +++++++++++++++++++++++++++++++------ 1 file changed, 110 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e4ab2a82..98fb55c89 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,6 +52,12 @@ jobs: files.pythonhosted.org:443 github.com:443 pypi.org:443 + - name: Start Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + label: 'Linting (Python${{ matrix.python-version }})' + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -61,12 +67,29 @@ jobs: - name: Install CI libraries run: | python -m pip install --require-hashes -r CI/requirements_ci.txt + - name: Setup Python Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'environment setup' + continue-on-error: true - name: Run pylint run: | python -m pylint --rcfile=.pylintrc.toml --disable=import-error --exit-zero xclim - name: Run linting suite run: | python -m tox -e lint + - name: Tests measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'linting' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true test-preliminary: name: Python${{ matrix.python-version }} (ubuntu-latest) @@ -89,6 +112,13 @@ jobs: github.com:443 pypi.org:443 raw.githubusercontent.com:443 + - name: Start Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + label: 'preliminary tests' + branch: ${{ github.event.pull_request.head.ref }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -98,11 +128,28 @@ jobs: - name: Install CI libraries run: | python -m pip install --require-hashes -r CI/requirements_ci.txt + - name: Environment Setup Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'environment setup' + continue-on-error: true - name: Test with tox run: | python -m tox -- -m 'not slow' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Tests measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'test with tox' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true test-pypi: needs: lint @@ -170,6 +217,12 @@ jobs: ppa.launchpadcontent.net:443 pypi.org:443 raw.githubusercontent.com:443 + - name: Start Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + branch: ${{ github.event.pull_request.head.ref }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Eigen3 (SBCK) @@ -184,6 +237,12 @@ jobs: - name: Install CI libraries run: | python -m pip install --require-hashes -r CI/requirements_ci.txt + - name: Environment Setup Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'environment setup' + continue-on-error: true - name: Test with tox if: ${{ matrix.tox-env == 'standard' }} run: | @@ -202,6 +261,17 @@ jobs: COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} COVERALLS_PARALLEL: true COVERALLS_SERVICE_NAME: github + - name: Tests measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'testing with tox' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true test-conda: needs: lint @@ -235,6 +305,12 @@ jobs: pypi.org:443 raw.githubusercontent.com:443 repo.anaconda.com:443 + - name: Start Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + branch: ${{ github.event.pull_request.head.ref }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} @@ -245,9 +321,6 @@ jobs: environment-file: environment.yml create-args: >- python=${{ matrix.python-version }} - - name: Micromamba version - run: | - echo "micromamba: $(micromamba --version)" - name: Install xclim run: | python -m pip install --no-user --editable . @@ -256,21 +329,15 @@ jobs: micromamba list xclim show_version_info python -m pip check || true + - name: Environment Setup Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'environment setup' + continue-on-error: true - name: Test with pytest run: | python -m pytest --numprocesses=logical --durations=10 --cov=xclim --cov-report=term-missing -# - name: Install tox -# shell: bash -l {0} -# run: | -# mamba install -n xclim39 tox tox-conda -# - name: Test -# shell: bash -l {0} -# run: | -# conda activate xclim39 -# tox -e opt-slow -# env: -# CONDA_EXE: mamba -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Report coverage run: | coveralls @@ -279,6 +346,17 @@ jobs: COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true COVERALLS_SERVICE_NAME: github + - name: Tests measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'testing with pytest (conda)' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true finish: needs: @@ -288,6 +366,12 @@ jobs: runs-on: ubuntu-latest container: python:3-slim steps: + - name: Start Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + branch: ${{ github.event.pull_request.head.ref }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -296,9 +380,14 @@ jobs: - name: Install CI libraries run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - - name: Coveralls finished - run: | - python -m coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_SERVICE_NAME: github + - name: Finish measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'finish' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true From eefceaf053ae082019a43412fcb4d29c9870c73a Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:23:47 -0400 Subject: [PATCH 02/22] WIP - audit connections --- .github/workflows/main.yml | 57 +++++++++----------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 98fb55c89..97bc7b593 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,17 +47,14 @@ jobs: uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: disable-sudo: true - egress-policy: block - allowed-endpoints: > - files.pythonhosted.org:443 - github.com:443 - pypi.org:443 + egress-policy: audit + - name: Start Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement label: 'Linting (Python${{ matrix.python-version }})' - continue-on-error: true + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -104,21 +101,15 @@ jobs: uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: disable-sudo: true - egress-policy: block - allowed-endpoints: > - api.github.com:443 - dap.service.does.not.exist:443 - files.pythonhosted.org:443 - github.com:443 - pypi.org:443 - raw.githubusercontent.com:443 + egress-policy: audit + - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement label: 'preliminary tests' branch: ${{ github.event.pull_request.head.ref }} - continue-on-error: true + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -203,26 +194,14 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: - egress-policy: block - allowed-endpoints: > - api.github.com:443 - azure.archive.ubuntu.com:80 - coveralls.io:443 - dap.service.does.not.exist:443 - esm.ubuntu.com:443 - files.pythonhosted.org:443 - github.com:443 - motd.ubuntu.com:443 - packages.microsoft.com:443 - ppa.launchpadcontent.net:443 - pypi.org:443 - raw.githubusercontent.com:443 + egress-policy: audit + - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - continue-on-error: true + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Eigen3 (SBCK) @@ -293,24 +272,14 @@ jobs: uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: disable-sudo: true - egress-policy: block - allowed-endpoints: > - api.github.com:443 - conda.anaconda.org:443 - coveralls.io:443 - dap.service.does.not.exist:443 - files.pythonhosted.org:443 - github.com:443 - objects.githubusercontent.com:443 - pypi.org:443 - raw.githubusercontent.com:443 - repo.anaconda.com:443 + egress-policy: audit + - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - continue-on-error: true + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} @@ -371,7 +340,7 @@ jobs: with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - continue-on-error: true + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: From d9bae89cfeb093c1faed851c6b22d7b1cb4bd345 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:42:59 -0400 Subject: [PATCH 03/22] WIP - secure endpoints --- .github/workflows/main.yml | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97bc7b593..5fa60652b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,14 +47,22 @@ jobs: uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: disable-sudo: true - egress-policy: audit - + egress-policy: block + allowed-endpoints: > + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + files.pythonhosted.org:443 + github.com:443 + ip-api.com:80 + proxy.golang.org:443 + pypi.org:443 + sum.golang.org:443 - name: Start Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement label: 'Linting (Python${{ matrix.python-version }})' - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -69,7 +77,6 @@ jobs: with: task: get-measurement label: 'environment setup' - continue-on-error: true - name: Run pylint run: | python -m pylint --rcfile=.pylintrc.toml --disable=import-error --exit-zero xclim @@ -81,12 +88,10 @@ jobs: with: task: get-measurement label: 'linting' - continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - continue-on-error: true test-preliminary: name: Python${{ matrix.python-version }} (ubuntu-latest) @@ -98,11 +103,22 @@ jobs: - "3.9" steps: - name: Harden Runner - uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 with: disable-sudo: true - egress-policy: audit - + egress-policy: block + allowed-endpoints: > + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + coveralls.io:443 + files.pythonhosted.org:443 + github.com:443 + ip-api.com:80 + proxy.golang.org:443 + pypi.org:443 + raw.githubusercontent.com:443 + sum.golang.org:443 - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: @@ -124,7 +140,6 @@ jobs: with: task: get-measurement label: 'environment setup' - continue-on-error: true - name: Test with tox run: | python -m tox -- -m 'not slow' @@ -135,12 +150,10 @@ jobs: with: task: get-measurement label: 'test with tox' - continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - continue-on-error: true test-pypi: needs: lint @@ -201,7 +214,6 @@ jobs: with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Eigen3 (SBCK) @@ -221,7 +233,6 @@ jobs: with: task: get-measurement label: 'environment setup' - continue-on-error: true - name: Test with tox if: ${{ matrix.tox-env == 'standard' }} run: | @@ -245,12 +256,10 @@ jobs: with: task: get-measurement label: 'testing with tox' - continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - continue-on-error: true test-conda: needs: lint @@ -279,7 +288,6 @@ jobs: with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} @@ -303,7 +311,6 @@ jobs: with: task: get-measurement label: 'environment setup' - continue-on-error: true - name: Test with pytest run: | python -m pytest --numprocesses=logical --durations=10 --cov=xclim --cov-report=term-missing @@ -320,12 +327,10 @@ jobs: with: task: get-measurement label: 'testing with pytest (conda)' - continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - continue-on-error: true finish: needs: @@ -340,7 +345,6 @@ jobs: with: task: start-measurement branch: ${{ github.event.pull_request.head.ref }} - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -354,9 +358,7 @@ jobs: with: task: get-measurement label: 'finish' - continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - continue-on-error: true From a9a6101d74ac27218038651fe3c6e21622d8d231 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:50:23 -0400 Subject: [PATCH 04/22] WIP - is coveralls service name required? --- .github/workflows/main.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5fa60652b..f13049cd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -125,7 +125,6 @@ jobs: task: start-measurement label: 'preliminary tests' branch: ${{ github.event.pull_request.head.ref }} - - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -145,6 +144,8 @@ jobs: python -m tox -- -m 'not slow' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} + COVERALLS_PARALLEL: true - name: Tests measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: @@ -241,7 +242,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} COVERALLS_PARALLEL: true - COVERALLS_SERVICE_NAME: github - name: Test with tox (specialized tests) if: ${{ matrix.tox-env != 'standard' }} run: | @@ -250,7 +250,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} COVERALLS_PARALLEL: true - COVERALLS_SERVICE_NAME: github - name: Tests measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: @@ -321,7 +320,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true - COVERALLS_SERVICE_NAME: github - name: Tests measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: @@ -353,6 +351,11 @@ jobs: - name: Install CI libraries run: | python -m pip install --require-hashes -r CI/requirements_ci.txt + - name: Coveralls finished + run: | + python -m coveralls --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Finish measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: From f772cfe642eacbf6291600f100b5e45ab26f64ef Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:27:23 -0400 Subject: [PATCH 05/22] WIP - do not run metrics on Windows/macOS --- .github/workflows/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f13049cd5..db047b790 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -211,6 +211,7 @@ jobs: egress-policy: audit - name: Start Energy Measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement @@ -218,7 +219,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Eigen3 (SBCK) - if: ${{ matrix.python-version == '3.11' }} + if: (matrix.python-version == '3.11') && (matrix.os == 'ubuntu-latest') run: | sudo apt-get update sudo apt-get install libeigen3-dev @@ -230,6 +231,7 @@ jobs: run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Environment Setup Energy Measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement @@ -251,11 +253,13 @@ jobs: COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} COVERALLS_PARALLEL: true - name: Tests measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement label: 'testing with tox' - name: Show Energy Results + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results @@ -283,6 +287,7 @@ jobs: egress-policy: audit - name: Start Energy Measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement @@ -306,6 +311,7 @@ jobs: xclim show_version_info python -m pip check || true - name: Environment Setup Energy Measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement @@ -321,11 +327,13 @@ jobs: COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true - name: Tests measurement + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement label: 'testing with pytest (conda)' - name: Show Energy Results + if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results From 60395743ea91ab1e130c13968f12ad1e0cd527c3 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:15:53 -0400 Subject: [PATCH 06/22] WIP - proper labelling --- .github/workflows/main.yml | 104 +++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db047b790..f33b61343 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,7 +62,8 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement - label: 'Linting (Python${{ matrix.python-version }})' + branch: ${{ github.head_ref || github.ref_name }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -76,7 +77,8 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'environment setup' + label: 'Environment setup (Python${{ matrix.python-version }}, lint)' + continue-on-error: true - name: Run pylint run: | python -m pylint --rcfile=.pylintrc.toml --disable=import-error --exit-zero xclim @@ -87,11 +89,13 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'linting' + label: 'Lint (Python${{ matrix.python-version }})' + continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results + continue-on-error: true test-preliminary: name: Python${{ matrix.python-version }} (ubuntu-latest) @@ -123,8 +127,8 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement - label: 'preliminary tests' - branch: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.head_ref || github.ref_name }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Python${{ matrix.python-version }} @@ -138,7 +142,8 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'environment setup' + label: 'Environment setup (Python${{ matrix.python-version }}, standard)' + continue-on-error: true - name: Test with tox run: | python -m tox -- -m 'not slow' @@ -150,11 +155,13 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'test with tox' + label: 'Testing with tox (Python${{ matrix.python-version }})' + continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results + continue-on-error: true test-pypi: needs: lint @@ -206,16 +213,32 @@ jobs: tox-env: doctests steps: - name: Harden Runner - uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 + if : ${{ matrix.os == 'ubuntu-latest' }} + uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 with: - egress-policy: audit - + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + azure.archive.ubuntu.com:80 + coveralls.io:443 + files.pythonhosted.org:443 + github.com:443 + ip-api.com:80 + motd.ubuntu.com:443 + proxy.golang.org:443 + pypi.org:443 + raw.githubusercontent.com:443 + sum.golang.org:443 - name: Start Energy Measurement if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement - branch: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.head_ref || github.ref_name }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Eigen3 (SBCK) @@ -235,7 +258,8 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'environment setup' + label: 'Environment setup (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' + continue-on-error: true - name: Test with tox if: ${{ matrix.tox-env == 'standard' }} run: | @@ -257,24 +281,25 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'testing with tox' + label: 'Testing with tox (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' + continue-on-error: true - name: Show Energy Results if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results + continue-on-error: true test-conda: needs: lint - name: Python${{ matrix.python-version }} (${{ matrix.os }}, conda) + name: Python${{ matrix.python-version }} (ubuntu-latest, conda) if: | contains(github.event.pull_request.labels.*.name, 'approved') || (github.event.review.state == 'approved') || (github.event_name == 'push') - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: [ ubuntu-latest ] python-version: [ "3.9", "3.12" ] defaults: run: @@ -284,14 +309,26 @@ jobs: uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: disable-sudo: true - egress-policy: audit - + egress-policy: block + allowed-endpoints: > + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + coveralls.io:443 + files.pythonhosted.org:443 + github.com:443 + ip-api.com:80 + objects.githubusercontent.com:443 + proxy.golang.org:443 + pypi.org:443 + raw.githubusercontent.com:443 + sum.golang.org:443 - name: Start Energy Measurement - if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement - branch: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.head_ref || github.ref_name }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} @@ -311,11 +348,11 @@ jobs: xclim show_version_info python -m pip check || true - name: Environment Setup Energy Measurement - if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'environment setup' + label: 'Environment setup (conda, Python${{ matrix.python-version }})' + continue-on-error: true - name: Test with pytest run: | python -m pytest --numprocesses=logical --durations=10 --cov=xclim --cov-report=term-missing @@ -327,30 +364,38 @@ jobs: COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true - name: Tests measurement - if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'testing with pytest (conda)' + label: 'Testing with pytest (conda, Python${{ matrix.python-version }})' + continue-on-error: true - name: Show Energy Results - if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results + continue-on-error: true finish: + name: Finish Run needs: - test-preliminary - test-pypi - test-conda runs-on: ubuntu-latest - container: python:3-slim + permissions: + pull-requests: write steps: + - name: Harden Runner + uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 + with: + disable-sudo: true + egress-policy: audit - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: start-measurement - branch: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.head_ref || github.ref_name }} + continue-on-error: true - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -368,8 +413,11 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement - label: 'finish' + label: 'Finish Run' + continue-on-error: true - name: Show Energy Results uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results + pr-comment: true + continue-on-error: true From ea3992a61a0227c9c14035fe65a4867be6e139bc Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 5 Aug 2024 11:32:33 -0400 Subject: [PATCH 07/22] allow sudo --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f33b61343..63628c810 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -216,7 +216,6 @@ jobs: if : ${{ matrix.os == 'ubuntu-latest' }} uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 with: - disable-sudo: true egress-policy: block allowed-endpoints: > api.electricitymap.org:443 From 93d4345ebf5f1b820e57e8ce4ad405e390f30c6b Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:33:25 -0400 Subject: [PATCH 08/22] add depedency review --- .github/workflows/dependency-review.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index f7814b0cc..088eac6d6 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -25,8 +25,22 @@ jobs: api.github.com:443 github.com:443 + - name: Start Energy Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: start-measurement + branch: ${{ github.head_ref || github.ref_name }} + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Dependency Review uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 + + - name: Energy Measurement + if : ${{ matrix.os == 'ubuntu-latest' }} + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: get-measurement + label: 'Dependency Review' + continue-on-error: true From 7a992f0095b2f765e38f9e3434994821c95c6bc2 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:49:49 -0400 Subject: [PATCH 09/22] wip - audit --- .github/workflows/dependency-review.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 088eac6d6..67e8ac49b 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -18,12 +18,7 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: - disable-sudo: true - egress-policy: block - allowed-endpoints: > - api.deps.dev:443 - api.github.com:443 - github.com:443 + egress-policy: audit - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 From 23f5981f725432616937d13d4208c32b11d3b29d Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:27:22 -0400 Subject: [PATCH 10/22] fix commenting --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63628c810..825fe34c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -375,7 +375,7 @@ jobs: continue-on-error: true finish: - name: Finish Run + name: Finish needs: - test-preliminary - test-pypi @@ -418,5 +418,4 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: display-results - pr-comment: true continue-on-error: true From 38f5b4a37f79d3028c281d26115fa2fd72b7bcaa Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:49:47 -0400 Subject: [PATCH 11/22] wip - fix reporting --- .github/workflows/dependency-review.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 67e8ac49b..8d0dd1a9c 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -33,9 +33,14 @@ jobs: uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 - name: Energy Measurement - if : ${{ matrix.os == 'ubuntu-latest' }} uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 with: task: get-measurement label: 'Dependency Review' continue-on-error: true + + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + with: + task: display-results + continue-on-error: true From ef8d010b8cae1cfaf44276293b93e04279455a7e Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:13:09 -0400 Subject: [PATCH 12/22] wip - try testing branch --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 825fe34c1..961ec8189 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -233,7 +233,7 @@ jobs: sum.golang.org:443 - name: Start Energy Measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -254,7 +254,7 @@ jobs: python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Environment Setup Energy Measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' @@ -277,14 +277,14 @@ jobs: COVERALLS_PARALLEL: true - name: Tests measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Testing with tox (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' continue-on-error: true - name: Show Energy Results if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true From f8a08fa1aec6f47c24391b3b1ab67e7feea15493 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:25:45 -0400 Subject: [PATCH 13/22] wip - use testing branch --- .github/workflows/dependency-review.yml | 6 ++--- .github/workflows/main.yml | 30 ++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 8d0dd1a9c..095f78d9f 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -21,7 +21,7 @@ jobs: egress-policy: audit - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -33,14 +33,14 @@ jobs: uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4 - name: Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Dependency Review' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 961ec8189..9bb57beb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: pypi.org:443 sum.golang.org:443 - name: Start Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -74,7 +74,7 @@ jobs: run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Setup Python Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, lint)' @@ -86,13 +86,13 @@ jobs: run: | python -m tox -e lint - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Lint (Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true @@ -124,7 +124,7 @@ jobs: raw.githubusercontent.com:443 sum.golang.org:443 - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -139,7 +139,7 @@ jobs: run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Environment Setup Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, standard)' @@ -152,13 +152,13 @@ jobs: COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.tox-env }} COVERALLS_PARALLEL: true - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Testing with tox (Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true @@ -323,7 +323,7 @@ jobs: raw.githubusercontent.com:443 sum.golang.org:443 - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -347,7 +347,7 @@ jobs: xclim show_version_info python -m pip check || true - name: Environment Setup Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Environment setup (conda, Python${{ matrix.python-version }})' @@ -363,13 +363,13 @@ jobs: COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Testing with pytest (conda, Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true @@ -390,7 +390,7 @@ jobs: disable-sudo: true egress-policy: audit - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -409,13 +409,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Finish measurement - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: get-measurement label: 'Finish Run' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@7333e9a8e8036e5bf69d59dc8bb63d984b0f55c8 # v3.1 + uses: green-coding-solutions/eco-ci-energy-estimation@escape-test with: task: display-results continue-on-error: true From 5cd24cdb6f8461d451d1402db92da6d13e008595 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:02:06 -0400 Subject: [PATCH 14/22] update allowlist --- .github/workflows/dependency-review.yml | 15 ++++++++++++++- .github/workflows/main.yml | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 095f78d9f..fe066bd71 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -18,7 +18,20 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0 with: - egress-policy: audit + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.deps.dev:443 + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + api.securityscorecards.dev:443 + github.com:443 + ip-api.com:80 + ipapi.co:443 + proxy.golang.org:443 + pypi.org:443 + sum.golang.org:443 - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@escape-test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9bb57beb4..45ad8868a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,6 +55,7 @@ jobs: files.pythonhosted.org:443 github.com:443 ip-api.com:80 + ipapi.co:443 proxy.golang.org:443 pypi.org:443 sum.golang.org:443 @@ -119,6 +120,7 @@ jobs: files.pythonhosted.org:443 github.com:443 ip-api.com:80 + ipapi.co:443 proxy.golang.org:443 pypi.org:443 raw.githubusercontent.com:443 @@ -226,6 +228,7 @@ jobs: files.pythonhosted.org:443 github.com:443 ip-api.com:80 + ipapi.co:443 motd.ubuntu.com:443 proxy.golang.org:443 pypi.org:443 @@ -317,6 +320,7 @@ jobs: files.pythonhosted.org:443 github.com:443 ip-api.com:80 + ipapi.co:443 objects.githubusercontent.com:443 proxy.golang.org:443 pypi.org:443 From b768233aa3623cbb27670e5e6be5d7e57651822c Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:46:15 -0500 Subject: [PATCH 15/22] update energy measurement action version to latest --- .github/workflows/main.yml | 38 ++++++++++++++++----------------- .github/workflows/scorecard.yml | 8 +++---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bbaa6ab7..c9dc334f6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: pypi.org:443 sum.golang.org:443 - name: Start Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -72,7 +72,7 @@ jobs: run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Setup Python Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, lint)' @@ -91,13 +91,13 @@ jobs: run: | python -m tox -e lint - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Lint (Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true @@ -131,7 +131,7 @@ jobs: raw.githubusercontent.com:443 sum.golang.org:443 - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -147,7 +147,7 @@ jobs: run: | python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Environment Setup Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, standard)' @@ -167,13 +167,13 @@ jobs: COVERALLS_FLAG_NAME: run-${{ matrix.python-version }}-ubuntu-latest-preliminary COVERALLS_PARALLEL: true - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Testing with tox (Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true @@ -256,7 +256,7 @@ jobs: sum.golang.org:443 - name: Start Energy Measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -278,7 +278,7 @@ jobs: python -m pip install --require-hashes -r CI/requirements_ci.txt - name: Environment Setup Energy Measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Environment setup (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' @@ -310,14 +310,14 @@ jobs: COVERALLS_PARALLEL: true - name: Tests measurement if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Testing with tox (Python${{ matrix.python-version }}, ${{ matrix.tox-env }})' continue-on-error: true - name: Show Energy Results if : ${{ matrix.os == 'ubuntu-latest' }} - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true @@ -359,7 +359,7 @@ jobs: raw.githubusercontent.com:443 sum.golang.org:443 - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -389,7 +389,7 @@ jobs: xclim show_version_info python -m pip check || true - name: Environment Setup Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Environment setup (conda, Python${{ matrix.python-version }})' @@ -405,13 +405,13 @@ jobs: COVERALLS_FLAG_NAME: run-{{ matrix.python-version }}-conda COVERALLS_PARALLEL: true - name: Tests measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Testing with pytest (conda, Python${{ matrix.python-version }})' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true @@ -430,7 +430,7 @@ jobs: disable-sudo: true egress-policy: audit - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -440,13 +440,13 @@ jobs: with: parallel-finished: true - name: Finish measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Finish Run' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 7965189a8..8477d39b1 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -35,12 +35,12 @@ jobs: egress-policy: audit - name: Checkout Repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Run Analysis - uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif @@ -59,7 +59,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: Upload Artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: SARIF file path: results.sarif @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: Upload to code-scanning - uses: github/codeql-action/upload-sarif@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # 3.23.0 + uses: github/codeql-action/upload-sarif@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # 3.23.0 with: sarif_file: results.sarif From 9e4e6b5f886c2203d3018c75bece37b662d167d5 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:09:05 -0500 Subject: [PATCH 16/22] add measurements to upstream.yml --- .github/workflows/dependency-review.yml | 6 ++--- .github/workflows/upstream.yml | 29 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 8e7d3e05a..dde423557 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -34,7 +34,7 @@ jobs: sum.golang.org:443 - name: Start Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: start-measurement branch: ${{ github.head_ref || github.ref_name }} @@ -46,14 +46,14 @@ jobs: uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0 - name: Energy Measurement - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: get-measurement label: 'Dependency Review' continue-on-error: true - name: Show Energy Results - uses: green-coding-solutions/eco-ci-energy-estimation@escape-test + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results continue-on-error: true diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 175c7be54..f5e284a7e 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -44,15 +44,27 @@ jobs: disable-sudo: true egress-policy: block allowed-endpoints: > + api.electricitymap.org:443 api.github.com:443 + api.green-coding.io:443 + api.securityscorecards.dev:443 conda.anaconda.org:443 dap.service.does.not.exist:443 files.pythonhosted.org:443 github.com:443 + ip-api.com:80 + ipapi.co:443 objects.githubusercontent.com:443 + proxy.golang.org:4433 pypi.org:443 raw.githubusercontent.com:443 repo.anaconda.com:443 + sum.golang.org:443 + - name: Start Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 + with: + task: start-measurement + branch: ${{ github.head_ref || github.ref_name }} - name: Checkout Repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: @@ -84,6 +96,12 @@ jobs: micromamba list xclim show_version_info python -m pip check || true + - name: Setup Python Measurement + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 + with: + task: get-measurement + label: 'Environment Setup (Upstream, Python${{ matrix.python-version }})' + continue-on-error: true - name: Test Data Caching uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 with: @@ -105,3 +123,14 @@ jobs: with: issue-title: "⚠️ Nightly upstream-dev CI failed for Python${{ matrix.python-version }} ⚠️" log-path: output-${{ matrix.python-version }}-log.jsonl + - name: Tests measurement + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 + with: + task: get-measurement + label: 'Testing and Reporting (Upstream, Python${{ matrix.python-version }})' + continue-on-error: true + - name: Show Energy Results + uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 + with: + task: display-results + continue-on-error: true From bb3cc81cf7c15d0f5b04694603567e536f784d85 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:12:14 -0500 Subject: [PATCH 17/22] handle race condition on teardown --- tests/conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index ba3597b17..0e3785c93 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ # noqa: D104 from __future__ import annotations +import logging import os from functools import partial from pathlib import Path @@ -411,6 +412,12 @@ def remove_data_written_flag(): """Cleanup cache folder once we are finished.""" flag = default_testdata_cache.joinpath(".data_written") if flag.exists(): - flag.unlink() + try: + flag.unlink() + except FileNotFoundError: + logging.info( + "Teardown race condition occurred: .data_written flag already removed. Lucky!" + ) + pass request.addfinalizer(remove_data_written_flag) From 13a91cbe6e2d807ed08e9bae331285a974221066 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:46:30 -0500 Subject: [PATCH 18/22] update CHANGELOG.rst --- CHANGELOG.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f85d72b51..67c7632a7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,7 +7,7 @@ v0.54.0 (unreleased) Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`). Breaking changes ----------------- +^^^^^^^^^^^^^^^^ * The minimum required version of `dask` has been increased to `2024.8.1`. (:issue:`1992`, :pull:`1991`). Bug fixes @@ -16,7 +16,12 @@ Bug fixes Internal changes ^^^^^^^^^^^^^^^^ -* Changed french translations with word "pluvieux" to "avec précipitations". (:issue:`1960`, :pull:`1994`). +* Changed French translations with word "pluvieux" to "avec précipitations". (:issue:`1960`, :pull:`1994`). +* Addressed a very rare race condition that can happen if `pytest` is tearing down the test environment when running across multiple workers. (:pull:`1863`). + +CI changes +^^^^^^^^^^ +* Added the `green-coding-solutions/eco-ci-energy-estimation` GitHub Action to the workflows to establish energy and carbon usage of CI activity. (:pull:`1863`). v0.53.2 (2024-10-31) -------------------- From 415ba6d2c8109cceb4adbe70d22ef2ebc007b96c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:55:24 -0500 Subject: [PATCH 19/22] add pr comment --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9dc334f6..2c34f0b56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -449,4 +449,5 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results + pr-comment: true continue-on-error: true From 2deb619e76df54948906e75cefaf280bec2c435c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:17:18 -0500 Subject: [PATCH 20/22] update permissions --- .github/workflows/main.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c34f0b56..3a3968d84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -423,12 +423,27 @@ jobs: - test-pypi - test-conda runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true - egress-policy: audit + egress-policy: block + allowed-endpoints: > + api.electricitymap.org:443 + api.github.com:443 + api.green-coding.io:443 + coveralls.io:443 + files.pythonhosted.org:443 + github.com:443 + ip-api.com:80 + ipapi.co:443 + objects.githubusercontent.com:443 + proxy.golang.org:443 + pypi.org:443 + sum.golang.org:443 - name: Start Energy Measurement uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: From 14e0cd0767b566cc46c529d9dea66d4fb178cb0c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:02:55 -0500 Subject: [PATCH 21/22] remove pr comment, add badge --- .github/workflows/main.yml | 1 - README.rst | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a3968d84..1faca5919 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -464,5 +464,4 @@ jobs: uses: green-coding-solutions/eco-ci-energy-estimation@86f1b2ee12db687bca0d15160a529bb64a7b60d9 # v4.0.0 with: task: display-results - pr-comment: true continue-on-error: true diff --git a/README.rst b/README.rst index 05d940f5a..227260d9e 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ xclim: Climate services library |logo| |logo-dark| |logo-light| +----------------------------+-----------------------------------------------------+ | Coding Standards | |black| |ruff| |pre-commit| |security| |fossa| | +----------------------------+-----------------------------------------------------+ -| Development Status | |status| |build| |coveralls| | +| Development Status | |status| |build| |coveralls| |energy| | +----------------------------+-----------------------------------------------------+ `xclim` is an operational Python library for climate services, providing numerous climate-related indicator tools @@ -168,6 +168,10 @@ This package was created with Cookiecutter_ and the `audreyfeldroy/cookiecutter- :target: https://bestpractices.coreinfrastructure.org/projects/6041 :alt: Open Source Security Foundation +.. |energy| image:: https://api.green-coding.io/v1/ci/badge/get?repo=Ouranosinc/xclim&branch=main/merge&workflow=47013755 + :target: https://metrics.green-coding.io/ci.html?repo=Ouranosinc/xclim&branch=main/merge&workflow=47013755 + :alt: Energy Consumption + .. |fair| image:: https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow :target: https://fair-software.eu :alt: FAIR Software Compliance From 770ccdd335731bca6811a6b0a625abe36ef73a4c Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Fri, 15 Nov 2024 16:08:24 -0500 Subject: [PATCH 22/22] fix URL --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 227260d9e..f02d9dbff 100644 --- a/README.rst +++ b/README.rst @@ -168,8 +168,8 @@ This package was created with Cookiecutter_ and the `audreyfeldroy/cookiecutter- :target: https://bestpractices.coreinfrastructure.org/projects/6041 :alt: Open Source Security Foundation -.. |energy| image:: https://api.green-coding.io/v1/ci/badge/get?repo=Ouranosinc/xclim&branch=main/merge&workflow=47013755 - :target: https://metrics.green-coding.io/ci.html?repo=Ouranosinc/xclim&branch=main/merge&workflow=47013755 +.. |energy| image:: https://api.green-coding.io/v1/ci/badge/get?repo=Ouranosinc/xclim&branch=main&workflow=47013755 + :target: https://metrics.green-coding.io/ci.html?repo=Ouranosinc/xclim&branch=main&workflow=47013755 :alt: Energy Consumption .. |fair| image:: https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow