-
Notifications
You must be signed in to change notification settings - Fork 988
171 lines (148 loc) · 5.33 KB
/
linux-tests.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Linux tests
on:
push:
branches:
- develop2
- release/*
pull_request:
branches:
- '*'
- 'release/*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_container:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.dockerfile_hash.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate Dockerfile checksum
id: dockerfile_hash
run: |
DOCKERFILE_HASH=$(find ./.ci/docker/conan-tests -type f -exec sha256sum {} \; | sha256sum | cut -d' ' -f1)
echo "tag=$DOCKERFILE_HASH" >> $GITHUB_OUTPUT
- name: Check if image exists
id: check_image
run: |
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} > /dev/null 2>&1; then
echo "status=exists" >> $GITHUB_OUTPUT
else
echo "status=no-image" >> $GITHUB_OUTPUT
fi
- name: Build and push image if not exists
if: steps.check_image.outputs.status == 'no-image'
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }} -f ./.ci/docker/conan-tests .
docker push ghcr.io/${{ github.repository_owner }}/conan-tests:${{ steps.dockerfile_hash.outputs.tag }}
linux_test_suite:
needs: build_container
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/conan-tests:${{ needs.build_container.outputs.image_tag }}
options: --user conan
strategy:
matrix:
python-version: ['3.12.3', '3.9.2', '3.8.6', '3.6.15']
test-type: ['unittests', 'integration', 'functional']
name: Conan ${{ matrix.test-type }} (${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
run: |
pyenv global ${{ matrix.python-version }}
python --version
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements*.txt') }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r conans/requirements.txt
pip install -r conans/requirements_dev.txt
pip install -r conans/requirements_server.txt
pip install meson
- name: Run tests
shell: bash
run: |
if [ "${{ matrix.test-type }}" == "unittests" ]; then
pytest test/unittests --durations=20 -n 4
elif [ "${{ matrix.test-type }}" == "integration" ]; then
pytest test/integration --durations=20 -n 4
elif [ "${{ matrix.test-type }}" == "functional" ]; then
pytest test/functional --durations=20 -n 4
fi
linux_docker_tests:
needs: build_container
runs-on: ubuntu-latest
name: Docker Runner Tests
strategy:
matrix:
python-version: [3.12, 3.9]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r conans/requirements.txt
pip install -r conans/requirements_dev.txt
pip install -r conans/requirements_server.txt
pip install -r conans/requirements_runner.txt
- name: Run tests
shell: bash
run: |
pytest -m docker_runner --durations=20 -rs
deploy_to_pypi_test:
needs: [build_container, linux_test_suite, linux_docker_tests]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop2'
name: Deploy to TestPyPI
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install twine
- name: Bump Dev Version
run: |
python .ci/bump_dev_version.py
- name: Build Package
run: |
python setup.py sdist
- name: Upload to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*
- name: Deploy conan-server to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_SERVER_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_SERVER_PASSWORD }}
run: |
rm -rf dist/
mv setup_server.py setup.py
python setup.py sdist
python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*