-
Notifications
You must be signed in to change notification settings - Fork 33
107 lines (90 loc) · 2.79 KB
/
test-build-publish.yml
File metadata and controls
107 lines (90 loc) · 2.79 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
name: DomainTools python wrapper CI/CD
on:
push:
pull_request:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: |
export TOX_SKIP_MISSING_INTERPRETERS="False";
tox -e py
e2e-tests:
runs-on: ubuntu-latest
env:
MITM_BASIC_AUTH_CONTAINER_NAME: e2e_test_mitm_basic_auth
MITM_CUSTOM_CERT_CONTAINER_NAME: e2e_test_mitm_custom_cert
DOCKER_NETWORK_NAME: e2e_test_docker_network
TEST_USER: integrations_testing
TEST_KEY: ${{ secrets.TEST_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r ./requirements/development.txt
- name: Setup E2E environment
run: |
sh ./tests/e2e/scripts/setup_e2e.sh
- name: Run E2E tests
run: |
python -m pytest -s --capture=sys -v --cov=domaintools tests/e2e
- name: Cleanup E2E environment
if: '!cancelled()'
run: |
sh ./tests/e2e/scripts/cleanup_e2e.sh
# run only in main and in pull request to `main` and in publish release
release-build:
if: |
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request' && github.base_ref == 'main') ||
(github.event_name == 'release' && github.event.action == 'published')
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Upload distributions as artifact
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
publish-to-pypi:
runs-on: ubuntu-latest
needs: release-build
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write # Required for OIDC trusted publishing
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish to PyPI using API token
uses: pypa/gh-action-pypi-publish@release/v1