CI-tests failures on Unix #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI tests - Macos - Core | |
| # CI tests ran every time new code is pushed to the repo | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches-ignore: | |
| - 'dependabot*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| detect-ci-skip: | |
| name: detect ci skip | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.repository == 'euroargodev/argopy' | |
| && (github.event_name == 'push' || github.event_name == 'pull_request') | |
| outputs: | |
| skipped: ${{ steps.detect-skip.outputs.trigger-found }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - uses: xarray-contrib/ci-trigger@v1.2 | |
| id: detect-skip | |
| with: | |
| keyword: "[skip-ci]" | |
| core-pinned: | |
| # CI tests for environments with core requirements in pinned versions | |
| # All commits must pass this | |
| name: Core - Pinned - Py${{matrix.python-version}} - ${{ matrix.os }} | |
| needs: detect-ci-skip | |
| runs-on: ${{ matrix.os }} | |
| if: needs.detect-ci-skip.outputs.skipped == 'false' | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| continue-on-error: ${{ matrix.experimental }} | |
| # timeout-minutes: 45 | |
| strategy: | |
| max-parallel: 12 | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| os: ["macos-latest"] | |
| experimental: [false] | |
| steps: | |
| - name: Energy Estimation - Initialize | |
| if: ${{matrix.os == 'ubuntu-latest'}} | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: start-measurement | |
| project: ${{ secrets.CARBONDB_PROJECT_UUID }} | |
| tags: "${{github.workflow}},core-pinned,OS-${{matrix.os}},Company-${{ secrets.CARBONDB_COMPANY_UUID }},Py-${{matrix.python-version}}" | |
| co2-grid-intensity-api-token: ${{ secrets.ELECTRICITY_MAPS_TOKEN }} | |
| send-data: true | |
| continue-on-error: true | |
| - uses: actions/checkout@v6 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v6.0.0 | |
| with: | |
| aws-region: us-west-1 | |
| role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ga-ci-tests-argopy-01 | |
| role-duration-seconds: 7200 | |
| - name: Increase swapfile | |
| if: ${{matrix.os == 'ubuntu-latest'}} | |
| run: | | |
| sudo swapoff -a | |
| sudo fallocate -l 8G /swapfile | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile | |
| sudo swapon --show | |
| - name: Set environment variables | |
| run: | | |
| echo "CONDA_ENV_FILE=ci/requirements/py${{matrix.python-version}}-core-pinned.yml" >> $GITHUB_ENV | |
| echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV | |
| echo "LOG_FILE=argopy-tests-Core-Pinned-Py${{matrix.python-version}}-${{matrix.os}}.log" >> $GITHUB_ENV | |
| - name: Setup Micromamba ${{ matrix.python-version }} | |
| uses: mamba-org/setup-micromamba@v3 | |
| with: | |
| micromamba-version: '1.5.10-0' | |
| environment-name: argopy-tests | |
| environment-file: ${{ env.CONDA_ENV_FILE }} | |
| init-shell: bash | |
| cache-environment: true | |
| cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}" | |
| create-args: >- | |
| python=${{matrix.python-version}} | |
| - name: Install argopy | |
| run: | | |
| python -m pip install --no-deps -e . | |
| - name: Version info | |
| run: | | |
| micromamba info | |
| micromamba list | |
| - name: Energy Estimation - Measure Tests Setup | |
| if: ${{matrix.os == 'ubuntu-latest'}} | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: get-measurement | |
| label: 'setup core-pinned' | |
| continue-on-error: true | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Show available system resources | |
| run: | | |
| python ci/resource_summary.py --system | |
| - name: Test with pytest | |
| run: | | |
| python ci/resource_summary.py pytest -ra -v -s -c argopy/tests/pytest.ini --durations=10 --cov=./ --cov-config=.coveragerc --cov-report xml:cov.xml --cov-report term-missing --log-file=${{env.LOG_FILE}} --junitxml=junit.xml -o junit_family=legacy | |
| - name: Resource summary | |
| if: always() | |
| run: | | |
| python - <<'PY' | |
| import json | |
| with open("ci/artifacts/resource_summary.json") as f: | |
| data = json.load(f) | |
| print("=" * 60) | |
| print("RESOURCE USAGE SUMMARY") | |
| print("=" * 60) | |
| print(f"Duration : {data['duration_minutes']}") | |
| print(f"Exit code : {data['exit_code']}") | |
| print("\nCPU") | |
| print(f" Avg : {data['cpu']['avg_percent']} %") | |
| print(f" Max : {data['cpu']['max_percent']} %") | |
| print("\nMemory") | |
| print(f" Avg used : {data['memory']['avg_used_gb']} GB") | |
| print(f" Peak used : {data['memory']['peak_used_gb']} GB") | |
| print(f" Avg usage : {data['memory']['avg_percent']} %") | |
| print(f" Max usage : {data['memory']['max_percent']} %") | |
| print("\nSamples") | |
| print(f" Collected : {data['samples_collected']}") | |
| print("=" * 60) | |
| PY | |
| - name: Upload resource summary | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Resource-Summary-${{matrix.python-version}}-${{matrix.os}} | |
| path: ci/artifacts/resource_summary.json | |
| retention-days: 90 | |
| - name: Energy Estimation - Measure Tests Exec | |
| if: ${{matrix.os == 'ubuntu-latest'}} | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: get-measurement | |
| label: 'pytest core-pinned' | |
| continue-on-error: true | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./cov.xml | |
| report_type: coverage | |
| flags: core, pinned, py${{matrix.python-version}}, ${{matrix.os}} | |
| name: codecov-github | |
| fail_ci_if_error: false | |
| env_vars: RUNNER_OS,PYTHON_VERSION | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| report_type: test_results | |
| flags: core, pinned, py${{matrix.python-version}}, ${{matrix.os}} | |
| fail_ci_if_error: false | |
| env_vars: RUNNER_OS,PYTHON_VERSION | |
| - name: Save tests log as artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Argopy-Tests-Core-${{matrix.python-version}}-${{matrix.os}} | |
| path: ${{env.LOG_FILE}} | |
| retention-days: 90 | |
| - name: Energy Estimation - Show Results | |
| if: ${{matrix.os == 'ubuntu-latest'}} | |
| uses: green-coding-solutions/eco-ci-energy-estimation@v5 | |
| with: | |
| task: display-results | |
| continue-on-error: true |