EOF classification implementation #2352
Workflow file for this run
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/CD Build Workflow | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
| env: | ||
| CANCEL_OTHERS: true | ||
| PATHS_IGNORE: '["**/README.rst", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]' | ||
| jobs: | ||
| check-jobs-to-skip: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
| steps: | ||
| - id: skip_check | ||
| uses: fkirc/skip-duplicate-actions@v5 | ||
| with: | ||
| cancel_others: true | ||
| paths_ignore: '["**/README.md", "**/docs/**", "**/ISSUE_TEMPLATE/**", "**/pull_request_template.md", "**/.vscode/**"]' | ||
| pre-commit-hooks: | ||
| needs: check-jobs-to-skip | ||
| if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} || ${{ github.event_name == 'push' }} | ||
|
Check warning on line 30 in .github/workflows/build_workflow.yml
|
||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - name: Checkout Code Repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.13' | ||
| - name: Install and Run Pre-commit | ||
| uses: pre-commit/action@v3.0.1 | ||
| build: | ||
| needs: check-jobs-to-skip | ||
| if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }} || ${{ github.event_name == 'push' }} | ||
|
Check warning on line 47 in .github/workflows/build_workflow.yml
|
||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
| defaults: | ||
| run: | ||
| shell: bash -l {0} | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Get Date | ||
| id: get-date | ||
| run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | ||
| - name: Set up Conda Environment | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| miniforge-variant: Miniforge3 | ||
| miniforge-version: latest | ||
| activate-environment: pcmdi_metrics_ci | ||
| environment-file: conda-env/ci.yml | ||
| channel-priority: flexible | ||
| auto-update-conda: true | ||
| python-version: ${{ matrix.python-version }} | ||
| use-mamba: false | ||
| conda-solver: classic | ||
| - name: Cache Conda Packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/conda_pkgs_dir | ||
| key: conda-${{ runner.os }}--${{ runner.arch }}--py${{ matrix.python-version }}--${{ steps.get-date.outputs.today }}--${{ hashFiles('conda-env/ci.yml') }}--${{ env.CACHE_NUMBER }} | ||
| env: | ||
| CACHE_NUMBER: 0 | ||
| - name: Verify Conda Environment | ||
| run: | | ||
| conda info | ||
| conda list | ||
| conda config --show-sources | ||
| conda config --show | ||
| - name: Install pcmdi_metrics | ||
| # Source: https://github.com/conda/conda-build/issues/4251#issuecomment-1053460542 | ||
| run: | | ||
| python -m pip install --no-build-isolation --no-deps -e . | ||
| - name: Run Tests | ||
| run: | | ||
| pytest | ||
| - name: Run Unit Tests | ||
| run: pytest tests | ||
| publish-docs: | ||
| if: ${{ github.event_name == 'push' }} || ${{ github.event_name == 'pull_request' }} | ||
|
Check warning on line 104 in .github/workflows/build_workflow.yml
|
||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| shell: bash -l {0} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
| - name: Cache Conda | ||
| uses: actions/cache@v4 | ||
| env: | ||
| CACHE_NUMBER: 0 | ||
| with: | ||
| path: ~/conda_pkgs_dir | ||
| key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda-env/dev.yml') }} | ||
| - name: Set up Conda Environment | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| activate-environment: pcmdi_metrics_dev | ||
| environment-file: conda-env/dev.yml | ||
| miniforge-variant: Miniforge3 | ||
| miniforge-version: latest | ||
| channel-priority: strict | ||
| auto-update-conda: true | ||
| use-mamba: false | ||
| conda-solver: classic | ||
| python-version: '3.13' | ||
| - name: Verify Conda Environment | ||
| run: | | ||
| conda info | ||
| conda list | ||
| conda config --show-sources | ||
| conda config --show | ||
| - name: Install pcmdi_metrics | ||
| run: | | ||
| python -m pip install --no-build-isolation --no-deps -e . | ||
| - name: Sphinx build | ||
| run: | | ||
| sphinx-build docs _build | ||
| - name: Deploy | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
| with: | ||
| publish_branch: gh-pages | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: _build/ | ||
| force_orphan: true | ||