1- name : Tests
1+ name : Test
22
33on :
44 push :
5- branches :
6- - " develop"
7- pull_request_target :
8- types : [ opened, synchronize, reopened, labeled ]
9- branches :
10- - " develop"
5+ branches : [develop, main]
6+ pull_request :
7+ branches : [develop, main]
118 workflow_dispatch :
129
1310jobs :
@@ -24,171 +21,96 @@ jobs:
2421
2522 unit-tests :
2623 # Only need access-check if not the bot
27- needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && ' access-check' || '' }}
24+ needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && fromJSON('[" access-check"]') || fromJSON('[]') }}
2825 runs-on : ubuntu-latest-8
2926 steps :
3027 - uses : actions/checkout@v4
3128 with :
3229 fetch-depth : 0
33- ref : ${{ github.event.pull_request.head.sha }}
34-
35- - name : Setup environment
36- uses : ./.github/actions/setup-environment
37-
38- - name : Test with pytest
39- timeout-minutes : 5
30+ - uses : actions/setup-python@v5
31+ with :
32+ python-version : " 3.11"
33+ - name : Install dependencies
4034 run : |
41- uv run pytest \
42- -n auto \
43- --cov src \
44- --timeout 15 \
45- -o junit_suite_name="${{github.job}}" \
46- tests/unit
47-
48- - uses : ./.github/actions/report
35+ python -m pip install --upgrade pip
36+ pip install -e ".[dev]"
37+ - name : Run tests
38+ run : |
39+ python -m pytest -xvs tests/unit
40+ - name : Upload coverage to Codecov
41+ uses : codecov/codecov-action@v4
4942 with :
50- flag : unit-tests
5143 codecov_token : ${{ secrets.CODECOV_TOKEN }}
5244
5345 codemod-tests :
5446 # Only need access-check if not the bot
55- needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && ' access-check' || '' }}
47+ needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && fromJSON('[" access-check"]') || fromJSON('[]') }}
5648 # TODO: re-enable when this check is a develop required check
5749 if : false
5850 runs-on : ubuntu-latest-32
59- strategy :
60- matrix :
61- sync_graph : [ true, false ]
62- size : [ small, large ]
63- exclude :
64- # Exclude large codemod tests when not needed
65- - size : ${{(contains(github.event.pull_request.labels.*.name, 'big-codemod-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch') && 'kevin' || 'large'}}
66- - size : large
67- sync_graph : true
68- concurrency :
69- group : ${{ github.workflow }}-${{github.ref}}-${{matrix.sync_graph}}-${{matrix.size}}-${{github.event_name == 'push'&& github.sha}}
70- cancel-in-progress : true
71- name : " Codemod tests ${{matrix.size}}: Sync Graph=${{matrix.sync_graph}}"
7251 steps :
7352 - uses : actions/checkout@v4
7453 with :
75- ref : ${{ github.event.pull_request.head.sha }}
76-
77- - name : Setup environment
78- uses : ./.github/actions/setup-environment
79-
80- - name : Cache oss-repos
81- uses : ./.github/actions/setup-oss-repos
82-
83- - name : Run ATS and Tests
84- uses : ./.github/actions/run-ats
85- timeout-minutes : 15
54+ fetch-depth : 0
55+ - uses : actions/setup-python@v5
56+ with :
57+ python-version : " 3.11"
58+ - name : Install dependencies
59+ run : |
60+ python -m pip install --upgrade pip
61+ pip install -e ".[dev]"
62+ - name : Run tests
63+ run : |
64+ python -m pytest -xvs tests/codemod
65+ - name : Upload coverage to Codecov
66+ uses : codecov/codecov-action@v4
8667 with :
87- default_tests : " tests/integration/codemod/test_codemods.py"
88- codecov_static_token : ${{ secrets.CODECOV_STATIC_TOKEN }}
8968 codecov_token : ${{ secrets.CODECOV_TOKEN }}
90- collect_args : " --size=${{matrix.size}} --sync-graph=${{matrix.sync_graph}}"
91- ats_collect_args : " --size=${{matrix.size}},--sync-graph=${{matrix.sync_graph}},"
92- codecov_flags : codemod-tests-${{matrix.size}}-${{matrix.sync_graph}}
93- env :
94- GITHUB_WORKSPACE : $GITHUB_WORKSPACE
9569
9670 parse-tests :
9771 # Only need access-check if not the bot
98- needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && ' access-check' || '' }}
72+ needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && fromJSON('[" access-check"]') || fromJSON('[]') }}
9973 if : contains(github.event.pull_request.labels.*.name, 'parse-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
10074 runs-on : ubuntu-latest-32
10175 steps :
10276 - uses : actions/checkout@v4
10377 with :
104- ref : ${{ github.event.pull_request.head.sha }}
105-
106- - name : Setup environment
107- uses : ./.github/actions/setup-environment
108-
109- - name : Cache oss-repos
110- uses : ./.github/actions/setup-oss-repos
111-
112- - name : Install yarn and pnpm
78+ fetch-depth : 0
79+ - uses : actions/setup-python@v5
80+ with :
81+ python-version : " 3.11"
82+ - name : Install dependencies
11383 run : |
114- npm install -g yarn &
115- npm install -g pnpm
116-
117- - name : Test with pytest
118- timeout-minutes : 15
119- env :
120- GITHUB_WORKSPACE : $GITHUB_WORKSPACE
84+ python -m pip install --upgrade pip
85+ pip install -e ".[dev]"
86+ - name : Run tests
12187 run : |
122- uv run pytest \
123- -n auto \
124- -o junit_suite_name="${{github.job}}" \
125- tests/integration/codemod/test_parse.py
126-
127- - uses : ./.github/actions/report
88+ python -m pytest -xvs tests/parse
89+ - name : Upload coverage to Codecov
90+ uses : codecov/codecov-action@v4
12891 with :
129- flag : no-flag
13092 codecov_token : ${{ secrets.CODECOV_TOKEN }}
13193
132- - name : Notify parse tests failure
133- uses : slackapi/slack-github-action@v2.1.0
134- if : failure() && github.event_name == 'push' && false
135- with :
136- webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
137- webhook-type : incoming-webhook
138- payload : |
139- {
140- "blocks": [
141- {
142- "type": "header",
143- "text": {
144- "type": "plain_text",
145- "text": "❌ Parse Tests Failed",
146- "emoji": true
147- }
148- },
149- {
150- "type": "section",
151- "text": {
152- "type": "mrkdwn",
153- "text": "*Branch:* ${{ github.ref_name }}\n*Triggered by:* <${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}>\n\n*Details:*\n• <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>"
154- }
155- },
156- {
157- "type": "context",
158- "elements": [
159- {
160- "type": "mrkdwn",
161- "text": "Failed at <!date^${{ github.event.head_commit.timestamp }}^{date_num} {time}|just now>"
162- }
163- ]
164- }
165- ]
166- }
167-
16894 integration-tests :
16995 # Only need access-check if not the bot
170- needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && ' access-check' || '' }}
96+ needs : ${{ github.triggering_actor != 'codegen-sh[bot]' && fromJSON('[" access-check"]') || fromJSON('[]') }}
17197 runs-on : ubuntu-latest-16
17298 steps :
17399 - uses : actions/checkout@v4
174100 with :
175- ref : ${{ github.event.pull_request.head.sha }}
176-
177- - name : Setup environment
178- uses : ./.github/actions/setup-environment
179-
180- - name : Test with pytest
181- timeout-minutes : 5
182- env :
183- GITHUB_WORKSPACE : $GITHUB_WORKSPACE
184- GITHUB_TOKEN : ${{ secrets.GHA_PAT }}
101+ fetch-depth : 0
102+ - uses : actions/setup-python@v5
103+ with :
104+ python-version : " 3.11"
105+ - name : Install dependencies
185106 run : |
186- uv run pytest \
187- -n auto \
188- -o junit_suite_name="${{github.job}}" \
189- tests/integration/codegen
190-
191- - uses : ./.github/actions/report
107+ python -m pip install --upgrade pip
108+ pip install -e ".[dev]"
109+ - name : Run tests
110+ run : |
111+ python -m pytest -xvs tests/integration
112+ - name : Upload coverage to Codecov
113+ uses : codecov/codecov-action@v4
192114 with :
193- flag : integration-tests
194115 codecov_token : ${{ secrets.CODECOV_TOKEN }}
116+
0 commit comments