-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (86 loc) · 2.47 KB
/
Copy pathtest.yml
File metadata and controls
103 lines (86 loc) · 2.47 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
name: Tests
on:
[push, pull_request]
defaults:
run:
shell: bash
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
version: "latest"
args: "check --fix-only --exit-non-zero-on-fix"
- uses: pre-commit-ci/lite-action@v1.1.0
if: always()
with:
msg: '[pre-commit.ci lite] apply automatic fixes for ruff linting errors'
unit-test:
needs: [ruff]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.12']
fail-fast: false
env:
BUILD_WHEEL: ${{ matrix.python-version == '3.12' && 'true' || '' }}
steps:
- name: Obtain SasData source from git
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
**/test.yml
**/requirements*.txt
### Build sasdata sdist and wheel
- name: Build sasdata
if: env.BUILD_WHEEL
run: |
python -m pip install build
python -m build --sdist --wheel
python -m pip install dist/sasdata*whl
- name: Publish sdist and wheel package
if: env.BUILD_WHEEL
uses: actions/upload-artifact@v4
with:
name: sasdata-${{ matrix.os }}-${{ matrix.python-version }}
path: |
dist/sasdata*whl
dist/sasdata*tar*
if-no-files-found: ignore
### Installation of test-dependencies
- name: Install Python dependencies (test)
run: |
python -m pip install -r requirements.txt -r requirements-test.txt
### Test sasdata
- name: Test with pytest
run: |
python -m pytest -v -s test
publish-to-pypi:
name: Publish to pypi
if: startsWith(github.ref, 'refs/tags/')
needs:
- unit-test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/sasdata
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
path: |
dist/sasdata*whl
dist/sasdata*tar*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1