Repository navigation
107 lines (88 loc) · 3.15 KB
/
Copy pathtest.yml
File metadata and controls
107 lines (88 loc) · 3.15 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
name: Run Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-14, macos-13]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Git
run: |
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry (Linux/Mac)
if: runner.os != 'Windows'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install Poetry (Windows)
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
shell: powershell
- name: Add Poetry to PATH (Windows)
if: runner.os == 'Windows'
run: |
$env:Path += ";C:\Users\runneradmin\AppData\Roaming\Python\Scripts"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [EnvironmentVariableTarget]::Process)
C:\Users\runneradmin\AppData\Roaming\Python\Scripts\poetry --version
shell: powershell
#----------------------------------------------
# Remove poetry.lock if it exists
#----------------------------------------------
- name: Remove poetry.lock (Linux/Mac)
if: runner.os != 'Windows'
run: |
if [ -f poetry.lock ]; then
rm poetry.lock
fi
- name: Remove poetry.lock (Windows)
if: runner.os == 'Windows'
run: |
if (Test-Path -Path poetry.lock) { Remove-Item poetry.lock }
shell: powershell
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project (Linux/Mac)
if: runner.os != 'Windows'
run: poetry install --no-interaction
- name: Install project (Windows)
if: runner.os == 'Windows'
run: |
C:\Users\runneradmin\AppData\Roaming\Python\Scripts\poetry install --no-interaction
shell: powershell
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests (Linux/Mac)
if: runner.os != 'Windows'
run: poetry run pytest
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: |
C:\Users\runneradmin\AppData\Roaming\Python\Scripts\poetry run pytest
shell: powershell