-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (150 loc) · 4.59 KB
/
test.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
name: Library Tests and Release
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12"]
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: iceaxe
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: iceaxe_test_db
ports:
- 5438:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install
- name: Run tests
run: |
poetry run pytest -v --continue-on-collection-errors
env:
ICEAXE_LOG_LEVEL: DEBUG
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: poetry install
- name: Run lint
run: make lint
full-build:
needs: [test, lint]
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Full Build') || startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Clean build artifacts
run: |
rm -rf build/
rm -rf iceaxe/*.so
rm -rf *.egg-info/
find . -type f -name "*.so" -delete
find . -type f -name "*.o" -delete
find . -type f -name "*.c" -delete
- name: Update version in pyproject.toml
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
poetry version $VERSION
shell: bash
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build SDist
if: matrix.os == 'ubuntu-latest'
run: poetry build --format sdist
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_BUILD: cp311-* cp312-*
CIBW_SKIP: "*-musllinux*"
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT: "CFLAGS='-std=c99'"
CIBW_BEFORE_BUILD: |
rm -rf {project}/build/
rm -rf {project}/*.egg-info/
find {project} -type f -name "*.so" -delete
find {project} -type f -name "*.o" -delete
find {project} -type f -name "*.c" -delete
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: |
dist/
wheelhouse/
release:
needs: [full-build]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/iceaxe
permissions:
id-token: write
steps:
- name: Download Ubuntu build
uses: actions/download-artifact@v4
with:
name: dist-ubuntu-latest
path: dist-raw/ubuntu
- name: Download macOS build
uses: actions/download-artifact@v4
with:
name: dist-macos-latest
path: dist-raw/macos
- name: Prepare distribution files
run: |
mkdir -p dist
cp -r dist-raw/ubuntu/dist/* dist/ 2>/dev/null || true
cp -r dist-raw/ubuntu/wheelhouse/* dist/ 2>/dev/null || true
cp -r dist-raw/macos/dist/* dist/ 2>/dev/null || true
cp -r dist-raw/macos/wheelhouse/* dist/ 2>/dev/null || true
echo "Content of dist directory:"
ls -la dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1