|
1 | | -name: CI/CD Build Workflow |
| 1 | +name: omega-pr |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [develop] |
| 6 | + paths: |
| 7 | + - 'components/omega/**' |
6 | 8 |
|
7 | 9 | pull_request: |
8 | 10 | branches: [develop] |
| 11 | + paths: |
| 12 | + - 'components/omega/**' |
9 | 13 |
|
10 | 14 | workflow_dispatch: |
11 | 15 |
|
12 | 16 | env: |
13 | 17 | CANCEL_OTHERS: false |
14 | 18 | PATHS_IGNORE: '["**/README.md", "**/doc/**"]' |
| 19 | + PYTHON_VERSION: "3.13" |
15 | 20 |
|
16 | 21 | jobs: |
17 | 22 | build: |
18 | | - name: lint with pre-commit and build docs |
| 23 | + if: ${{ github.repository == 'E3SM-Project/E3SM' }} or \ |
| 24 | + ${{ github.repository == 'E3SM-Project/Omega' }} |
| 25 | + name: lint and test docs |
19 | 26 | runs-on: ubuntu-latest |
20 | 27 | timeout-minutes: 20 |
21 | 28 | defaults: |
22 | 29 | run: |
23 | 30 | shell: bash -l {0} |
24 | | - strategy: |
25 | | - matrix: |
26 | | - python-version: ["3.10",] |
27 | 31 | steps: |
28 | | - - id: skip_check |
29 | | - uses: fkirc/skip-duplicate-actions@master |
30 | | - with: |
31 | | - cancel_others: ${{ env.CANCEL_OTHERS }} |
32 | | - paths_ignore: ${{ env.PATHS_IGNORE }} |
33 | | - |
34 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
35 | | - name: Checkout Code Repository |
| 32 | + - name: Checkout Code Repository |
36 | 33 | uses: actions/checkout@v3 |
37 | 34 |
|
38 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
39 | | - name: Cache Conda |
40 | | - uses: actions/cache@v3 |
41 | | - env: |
42 | | - # Increase this value to reset cache if conda-dev-spec.template has not changed in the workflow |
43 | | - CACHE_NUMBER: 0 |
44 | | - with: |
45 | | - path: ~/conda_pkgs_dir |
46 | | - key: |
47 | | - ${{ runner.os }}-${{ matrix.python-version }}-conda-${{ env.CACHE_NUMBER }}-${{ |
48 | | - hashFiles('components/omega/dev-conda.txt') }} |
49 | | - |
50 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
51 | | - name: Set up Conda Environment |
52 | | - uses: conda-incubator/setup-miniconda@v2 |
| 35 | + - name: Set up Conda Environment |
| 36 | + uses: conda-incubator/setup-miniconda@v3 |
53 | 37 | with: |
54 | 38 | activate-environment: "omega_ci" |
55 | 39 | miniforge-version: latest |
56 | | - channels: conda-forge,defaults |
| 40 | + channels: conda-forge |
57 | 41 | channel-priority: strict |
58 | 42 | auto-update-conda: true |
59 | | - python-version: ${{ matrix.python-version }} |
| 43 | + python-version: ${{ env.PYTHON_VERSION }} |
60 | 44 |
|
61 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
62 | | - name: Install dependencies |
| 45 | + - name: Install dependencies |
63 | 46 | run: | |
64 | 47 | conda create -n omega_dev --file components/omega/dev-conda.txt \ |
65 | | - python=${{ matrix.python-version }} |
| 48 | + python=${{ env.PYTHON_VERSION }} |
66 | 49 | conda activate omega_dev |
67 | 50 | conda list |
68 | 51 |
|
69 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
70 | | - id: file_changes |
| 52 | + - id: file_changes |
71 | 53 | |
72 | 54 | with: |
73 | 55 | output: ' ' |
74 | 56 |
|
75 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
76 | | - name: Cache pre-commit |
77 | | - uses: actions/cache@v4 |
78 | | - with: |
79 | | - path: ~/.cache/pre-commit/ |
80 | | - key: ${{ runner.os }}-${{ matrix.python-version }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
81 | | - |
82 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
83 | | - # Run all pre-commit hooks on all the files. |
84 | | - # Getting only staged files can be tricky in case a new PR is opened |
85 | | - # since the action is run on a branch in detached head state |
86 | | - name: Run pre-commit |
| 57 | + - name: Run pre-commit |
87 | 58 | run: | |
88 | 59 | conda activate omega_dev |
89 | 60 | pre-commit run --show-diff-on-failure --files ${{ steps.file_changes.outputs.files}} |
90 | 61 |
|
91 | | - - if: ${{ steps.skip_check.outputs.should_skip != 'true' }} |
92 | | - name: Build Sphinx Docs |
| 62 | + - name: Build Sphinx Docs |
93 | 63 | run: | |
94 | 64 | conda activate omega_dev |
95 | 65 | cd components/omega/doc |
96 | | - make html |
| 66 | + make html-strict |
0 commit comments