|
| 1 | +name: 'linting and testing' |
1 | 2 | on:
|
2 | 3 | pull_request:
|
3 | 4 | types:
|
4 | 5 | - opened
|
5 |
| - - synchronized |
| 6 | + - synchronize |
6 | 7 |
|
7 |
| - jobs: |
8 |
| - which-paths: |
9 |
| - runs-on: ubuntu-latest |
10 |
| - outputs: |
11 |
| - HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }} |
12 |
| - MANAGEMENT_DIFF: ${{ steps.management-diff.outputs.MANAGEMENT_DIFF }} |
13 |
| - steps: |
14 |
| - - name: Fetch repo for diffing |
15 |
| - uses: actions/checkout@v3 |
16 |
| - - name: Check if vcs-tunable-analysis changed |
17 |
| - uses: actions/get-diff-action@v6 |
18 |
| - with: |
19 |
| - PATTERNS: | |
20 |
| - +hatch-vcs-tunable/**/* |
21 |
| - +.github/workflows/pull-request.yml |
22 |
| - - name: Set diff output for hatch-vcs-tunable |
23 |
| - id: hatch-vcs-tunable-diff |
24 |
| - run: | |
25 |
| - echo "HATCH_VCS_TUNABLE_DIFF=${GIT_DIFF_FILTERED}" >> $GITHUB_OUTPUT |
26 |
| - - name: Check if repo management changed |
27 |
| - uses: actions/get-diff-action@v6 |
28 |
| - with: |
29 |
| - PATTERNS: | |
30 |
| - -hatch-vcs-tunable/**/* |
31 |
| - - name: Set diff output for management |
32 |
| - id: management-diff |
33 |
| - run: | |
34 |
| - echo MANAGEMENT_DIFF=${GIT_DIFF_FILTERED}" >> $GITHUB_OUTPUT |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 10 | + cancel-in-progress: true |
35 | 11 |
|
36 |
| - hatch-vcs-tunable-analysis: |
37 |
| - if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }} |
38 |
| - runs-on: ubuntu-latest |
39 |
| - needs: [which-paths] |
40 |
| - steps: |
41 |
| - - name: Install python |
42 |
| - uses: actions/setup-python@v5 |
43 |
| - with: |
44 |
| - python-version: 3.10 |
45 |
| - - name: Set up python environment |
46 |
| - run: | |
47 |
| - python -m install pipx |
48 |
| - pipx install hatch |
49 |
| - - name: Fetch repo |
50 |
| - uses: actions/checkout@v3 |
51 |
| - - name: Create default env |
52 |
| - run: hatch env create default |
53 |
| - working-directory: hatch-vcs-tunable |
54 |
| - - name: Check formatting |
55 |
| - run: hatch run format --check |
56 |
| - working-directory: hatch-vcs-tunable |
57 |
| - - name: Lint |
58 |
| - run: hatch run lint |
59 |
| - working-directory: hatch-vcs-tunable |
60 |
| - - name: Check types |
61 |
| - run: hatch run check |
62 |
| - - name: Quick tests |
63 |
| - run: hatch run test |
| 12 | +jobs: |
| 13 | + which-paths: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }} |
| 17 | + MANAGEMENT_DIFF: ${{ steps.management-diff.outputs.MANAGEMENT_DIFF }} |
| 18 | + steps: |
| 19 | + - name: Fetch repo for diffing |
| 20 | + uses: actions/checkout@v3 |
| 21 | + - name: Check if vcs-tunable-analysis changed |
| 22 | + uses: technote-space/get-diff-action@v6 |
| 23 | + with: |
| 24 | + PATTERNS: | |
| 25 | + hatch-vcs-tunable/**/* |
| 26 | + hatch-vcs-tunable/**/.* |
| 27 | + FILES: | |
| 28 | + .github/workflows/pull-request.yml |
| 29 | + - name: Set diff output for hatch-vcs-tunable |
| 30 | + id: hatch-vcs-tunable-diff |
| 31 | + run: | |
| 32 | + echo "HATCH_VCS_TUNABLE_DIFF=\"$(echo ${GIT_DIFF_FILTERED} | sed 's/ *$//')\"" >> $GITHUB_OUTPUT |
| 33 | + - name: Check if repo management changed |
| 34 | + uses: technote-space/get-diff-action@v6 |
| 35 | + with: |
| 36 | + PATTERNS: | |
| 37 | + **/* |
| 38 | + .* |
| 39 | + .*/**/* |
| 40 | + !hatch-vcs-tunable/**/* |
| 41 | + - name: Set diff output for management |
| 42 | + id: management-diff |
| 43 | + run: | |
| 44 | + echo "MANAGEMENT_DIFF=\"$(echo ${GIT_DIFF_FILTERED} | set 's/ *$//')\"" >> $GITHUB_OUTPUT |
64 | 45 |
|
65 |
| - hatch-vcs-tunable-tests: |
66 |
| - if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }} |
67 |
| - needs: [which-paths, hatch-vcs-tunable-analysis] |
68 |
| - runs-on: ${{ matrix.env }} |
69 |
| - strategy: |
70 |
| - fail-fast: true |
71 |
| - matrix: |
72 |
| - os: [ubuntu-latest, windows-latest, macos-latest] |
73 |
| - steps: |
74 |
| - - name: Install python |
75 |
| - uses: actions/setup-python@v5 |
76 |
| - with: |
77 |
| - python-version: 3.10 |
78 |
| - - name: Set up python environment |
79 |
| - run: | |
80 |
| - python -m install pipx |
81 |
| - pipx install hatch |
82 |
| - - name: Fetch repo |
83 |
| - uses: actions/checkout@v3 |
84 |
| - - name: Create default env |
85 |
| - run: hatch env create test |
86 |
| - - name: Run all tests |
87 |
| - run: hatch run test:test |
| 46 | + hatch-vcs-tunable-analysis: |
| 47 | + if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF != '""' }} |
| 48 | + runs-on: ubuntu-latest |
| 49 | + needs: [which-paths] |
| 50 | + steps: |
| 51 | + - name: Install python |
| 52 | + uses: actions/setup-python@v5 |
| 53 | + with: |
| 54 | + python-version: '3.10' |
| 55 | + - name: Set up python environment |
| 56 | + run: | |
| 57 | + python -m pip install pipx |
| 58 | + pipx install hatch |
| 59 | + - name: Fetch repo |
| 60 | + uses: actions/checkout@v3 |
| 61 | + - name: Create default env |
| 62 | + run: hatch env create default |
| 63 | + working-directory: hatch-vcs-tunable |
| 64 | + - name: Check formatting |
| 65 | + run: hatch run format --check |
| 66 | + working-directory: hatch-vcs-tunable |
| 67 | + - name: Lint |
| 68 | + run: hatch run lint |
| 69 | + working-directory: hatch-vcs-tunable |
| 70 | + - name: Check types |
| 71 | + run: hatch run check |
| 72 | + working-directory: hatch-vcs-tunable |
| 73 | + - name: Quick tests |
| 74 | + run: hatch run test |
| 75 | + working-directory: hatch-vcs-tunable |
| 76 | + |
| 77 | + hatch-vcs-tunable-tests: |
| 78 | + if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF != '""' }} |
| 79 | + needs: [which-paths, hatch-vcs-tunable-analysis] |
| 80 | + runs-on: ${{ matrix.os }} |
| 81 | + strategy: |
| 82 | + fail-fast: true |
| 83 | + matrix: |
| 84 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 85 | + steps: |
| 86 | + - name: Install python |
| 87 | + uses: actions/setup-python@v5 |
| 88 | + with: |
| 89 | + python-version: '3.10' |
| 90 | + - name: Set up python environment |
| 91 | + run: | |
| 92 | + python -m pip install pipx |
| 93 | + pipx install hatch |
| 94 | + - name: Fetch repo |
| 95 | + uses: actions/checkout@v3 |
| 96 | + - name: Create test env |
| 97 | + run: hatch env create test |
| 98 | + working-directory: hatch-vcs-tunable |
| 99 | + - name: Run all tests |
| 100 | + run: hatch run test:test |
| 101 | + working-directory: hatch-vcs-tunable |
0 commit comments