Repository navigation
Expand file tree
/
Copy pathtest-run-dev-version-nightly.yml
More file actions
172 lines (149 loc) · 5.8 KB
/
Copy pathtest-run-dev-version-nightly.yml
File metadata and controls
172 lines (149 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Test Run Dev Version Nightly
on:
schedule: # UTC at 0300
- cron: "0 0 * * *"
workflow_dispatch:
concurrency:
group: test-run-dev-version-nightly-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read # Required for actions/checkout and repository reads.
packages: read # Required for docker/login-action access to GHCR images.
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_TIMEOUT_FORCE_EXIT: 30
PYTEST_XDIST_AUTO_NUM_WORKERS: 1
PYFLUENT_LAUNCH_CONTAINER: 1
PYFLUENT_LOGGING: "DEBUG"
PYFLUENT_WATCHDOG_DEBUG: "OFF"
PYFLUENT_HIDE_LOG_SECRETS: 1
PYTHON_VERSION: "3.12"
FLUENT_VERSION: 272
jobs:
test:
name: Unit Testing
runs-on: [self-hosted, pyfluent]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Clean Docker Data
run: make docker-clean-all-except-supported-images
env:
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
- name: Cache pip
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
Python-${{ runner.os }}-${{ env.PYTHON_VERSION }}
- name: Add version information
run: make version-info
- name: Install pyfluent
run: make install
- name: Retrieve PyFluent version
run: |
echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)"
id: version
- name: Login to GitHub Container Registry
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0
with:
registry: ghcr.io
username: ansys-bot
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Fluent docker image
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
- name: Run API codegen
run: make api-codegen
env:
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
- name: Print Fluent version info
env:
VERSION: ${{ env.FLUENT_VERSION }}
run: |
cat src/ansys/fluent/core/generated/v${VERSION}/fluent_version.py
- name: Install again after codegen
run: |
rm -rf dist
make install > /dev/null
- name: Unit Testing
id: unittest
run: |
make install-test
make unittest-all-${VERSION}
env:
VERSION: ${{ env.FLUENT_VERSION }}
FLUENT_IMAGE_TAG: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
FLUENT_WEBSERVER_TOKEN: ${{ vars.FLUENT_WEBSERVER_TOKEN }}
continue-on-error: true
- name: Clean Docker Data
run: make docker-clean-all-except-supported-images
env:
FLUENT_STABLE_IMAGE_DEV: ${{ vars.FLUENT_STABLE_IMAGE_DEV }}
- name: Send GitHub Actions Run Status Adaptive Card to Teams via Power Automate
if: github.event_name == 'schedule' && steps.unittest.outcome != 'success'
run: | # zizmor: ignore[template-injection]
STATUS="Failure"
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
JSON_PAYLOAD=$(jq -n \
--arg status "$STATUS" \
--arg branch "${{ github.ref_name }}" \
--arg commit "${{ github.sha }}" \
--arg commit_url "$COMMIT_URL" \
--arg run_url "$RUN_URL" \
'{
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"weight": "Bolder",
"size": "Medium",
"text": "${{ github.workflow }}"
},
{
"type": "TextBlock",
"text": "Status: \($status)"
},
{
"type": "TextBlock",
"text": "Branch: \($branch)"
},
{
"type": "TextBlock",
"text": "Commit: \($commit)"
},
{
"type": "TextBlock",
"text": "[View Commit](\($commit_url))"
},
{
"type": "TextBlock",
"text": "[View Run](\($run_url))"
}
]
}
}
]
}'
)
echo "Sending notification to Power Automate..."
curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" "${{ secrets.PYFLUENT_WEBHOOK_URL }}"
- name: Check test run status and fail the whole job if tests failed
if: steps.unittest.outcome != 'success'
run: |
echo "One or more tests failed. Failing the job."
exit 1