forked from cubewise-code/tm1py
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2 KB
/
unit_test_pipeline.yml
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
name: TM1Py Integration Tests
on:
workflow_dispatch:
inputs:
environments:
description: 'JSON array of environments to test (e.g., ["tm1-11-onprem", "tm1-11-cloud"])'
required: true
default: '["tm1-11-onprem","tm1-11-cloud","tm1-12-mcsp"]'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
environment: ${{ fromJson(github.event.inputs.environments) }}
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install -e .[unit_test]
- name: Retrieve TM1 Connection Details
id: get-connection
run: echo "Retrieving TM1 connection details"
env:
TM1_CONNECTION: ${{ vars.TM1_CONNECTION }}
TM1_CONNECTION_SECRET: ${{ secrets.TM1_CONNECTION_SECRET }}
- name: Generate config.ini
run: |
python Tests/resources/generate_config.py
env:
TM1_CONNECTION: ${{ vars.TM1_CONNECTION }}
TM1_CONNECTION_SECRET: ${{ secrets.TM1_CONNECTION_SECRET }}
- name: Run tests
run: pytest Tests/
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.environment }}
path: Tests/test-reports/
# Optional: Post results to PR
- name: Post comment to PR
if: always() && github.event_name == 'workflow_dispatch' && github.event.pull_request
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: 'Tests completed for environment: ${{ matrix.environment }}. Check artifacts for details.'
})