forked from pdudaemon/pdudaemon
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (103 loc) · 3.36 KB
/
tests.yaml
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
name: Run tests
on:
push:
branches-ignore:
- "gh-readonly-queue/**"
tags:
- "*"
workflow_dispatch:
pull_request:
merge_group:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Build container
run: docker build -t pdudaemon-ci -f Dockerfile.dockerhub .
- name: Run pytest
run: docker run -v $(pwd):/p -w /p pdudaemon-ci /root/.local/pipx/venvs/pdudaemon/bin/pytest
- name: Run functional tests
run: docker run -v $(pwd):/p -w /p pdudaemon-ci sh -c "./share/pdudaemon-test.sh"
tests-trixie:
runs-on: ubuntu-latest
steps:
- name: check out repository code
uses: actions/checkout@v4
- name: Build container
run: docker build --build-arg DEBIAN_VERSION=trixie -t pdudaemon-ci -f Dockerfile.dockerhub .
- name: Run pytest
run: docker run -v $(pwd):/p -w /p pdudaemon-ci /root/.local/share/pipx/venvs/pdudaemon/bin/pytest
- name: Run functional tests
run: docker run -v $(pwd):/p -w /p pdudaemon-ci sh -c "./share/pdudaemon-test.sh"
tests-trixie-python312:
runs-on: ubuntu-latest
steps:
- name: check out repository code
uses: actions/checkout@v4
- name: Build container
run: >
docker build
--build-arg DEBIAN_VERSION=trixie
--build-arg PYTHON=python3.12
-t pdudaemon-ci -f Dockerfile.dockerhub
.
- name: Run pytest
run: docker run -v $(pwd):/p -w /p pdudaemon-ci /root/.local/share/pipx/venvs/pdudaemon/bin/pytest
- name:
# disable snmp as pysnmp is incompatible with python3.12
run: sed -i 's,"snmpv.","localcmdline",g' share/pdudaemon.conf
- name: Run functional tests
run: docker run -v $(pwd):/p -w /p pdudaemon-ci sh -c "./share/pdudaemon-test.sh"
build:
needs:
- tests
- tests-trixie
- tests-trixie-python312
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
# include tags and full history for setuptools_scm
fetch-depth: 0
- name: Install build deps
run: python -m pip install -U build
- name: Build package
run: python -m build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
pypi-publish-test:
if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/main') }}
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish distribution package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
pypi-publish:
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
needs: pypi-publish-test
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1