-
Notifications
You must be signed in to change notification settings - Fork 69
131 lines (112 loc) · 3.82 KB
/
Copy pathTest.yml
File metadata and controls
131 lines (112 loc) · 3.82 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
name: Test-Publish
on:
push:
branches: ['master']
tags:
- 'v*' # only publish when pushing version tags (e.g., v1.0.0)
pull_request:
workflow_dispatch:
inputs:
pytest_args:
description: 'Extra pytest arguments'
required: false
default: ''
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
matrix:
# test for:
# * oldest supported version
# * latest available Python version
python-version: ['3.10']
# * Linux using ubuntu-latest
# * Windows using windows-latest
os: ['windows-latest']
# * OM stable - latest stable version
# * OM nightly - latest nightly build
omc-version: ['stable']
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build setuptools wheel twine
pip install . pytest pytest-md pytest-emoji pre-commit
- name: Set timezone
uses: szenius/set-timezone@v2.0
with:
timezoneLinux: 'Europe/Berlin'
- name: Run pre-commit linters
run: 'pre-commit run --all-files'
- name: "Set up OpenModelica Compiler"
uses: OpenModelica/setup-openmodelica@v1.0.7
with:
version: ${{ matrix.omc-version }}
packages: |
omc
libraries: |
'Modelica 4.0.0'
- run: "omc --version"
- name: Pull OpenModelica docker image
if: runner.os != 'Windows'
run: docker pull openmodelica/openmodelica:v1.25.0-minimal
- name: Build wheel and sdist packages
run: python -m build --wheel --sdist --outdir dist
- name: Check twine
run: python -m twine check dist/*
- name: Disable Windows Error Reporting dialogs
if: runner.os == 'Windows'
run: |
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f
- name: Run pytest
uses: pavelzw/pytest-action@v2
with:
verbose: true
emoji: true
job-summary: true
custom-arguments: '-v --log-cli-level=DEBUG ${{ inputs.pytest_args }} ./tests'
click-to-expand: true
report-title: 'Test Report'
# - name: Run pytest based on v4.0.0 compatibility layer
# uses: pavelzw/pytest-action@v2
# with:
# verbose: true
# emoji: true
# job-summary: true
# custom-arguments: '-v ./tests_v400'
# click-to-expand: true
# report-title: 'Test Report (v4.0.0 compatibility layer)'
Publish:
name: Publish to PyPI
runs-on: ${{ matrix.os }}
needs: test
strategy:
matrix:
python-version: ['3.10']
os: ['ubuntu-latest']
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build setuptools wheel twine
- name: Build wheel and sdist packages
run: python -m build --wheel --sdist --outdir dist
- name: Publish wheel and sdist packages to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_OMPYTHON_API_TOKEN }}
run: |
python -m twine upload dist/* --skip-existing