-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (138 loc) · 4.84 KB
/
ci.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
name: Continuous Integration
on:
push:
branches:
- main
tags:
- "*"
pull_request:
schedule:
- cron: '30 2 * * 1,4' # Every Monday and Thursday @ 2h30am UTC
env:
VCPKG_INSTALLED_DIR: /tmp/vcpkg_installed
ARTIFACT_NAME: distribution
jobs:
build-sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
python: ["3.8"]
steps:
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Upgrade pip and install build
run: python -m pip install -U pip build
- name: Checkout source
uses: actions/checkout@v3
- name: Build source distribution
run: python -m build --sdist
- name: Upload wheel artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./dist/*.tar.gz
build-wheels:
name: Build and Test Binary Wheels
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
# https://peps.python.org/pep-0425
python:
# python version, cpython tag
- ["3.8", "cp38"]
- ["3.9", "cp39"]
- ["3.10", "cp310"]
- ["3.11", "cp311"]
platform:
# platform tag, manylinux tag, vcpkg triplet
- [manylinux_x86_64, manylinux2014, x64-linux-dynamic-cxx17-abi0-rel]
steps:
- name: Set up Python ${{ matrix.python[0] }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python[0] }}
- name: Upgrade pip and install virtualenv
run: python -m pip install -U pip virtualenv
- name: Checkout source
uses: actions/checkout@v3
- name: Get Github Action Cache Variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Run cibuildwheel
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python[1] }}-${{ matrix.platform[0] }}
CIBW_BUILD_FRONTEND: build
CIBW_BEFORE_ALL_LINUX: yum install -y zip flex bison gcc-gfortran
CIBW_ENVIRONMENT_LINUX: >
ACTIONS_CACHE_URL=${{ env.ACTIONS_CACHE_URL }}
ACTIONS_RUNTIME_TOKEN=${{ env.ACTIONS_RUNTIME_TOKEN }}
VCPKG_BINARY_SOURCES="clear;x-gha,readwrite"
VCPKG_TARGET_TRIPLET=${{ matrix.platform[2] }}
VCPKG_INSTALLED_DIR=${{ env.VCPKG_INSTALLED_DIR }}
LD_LIBRARY_PATH=${{ env.VCPKG_INSTALLED_DIR }}/${{ matrix.platform[2] }}/lib
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
auditwheel repair -w {dest_dir} {wheel} --exclude libarrow_python.so --exclude libarrow.so.1200
CIBW_TEST_SKIP: "*"
CIBW_TEST_EXTRAS:
CIBW_TEST_COMMAND: python -c 'from arcae.lib.arrow_tables import Table'
- name: Upload wheel artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./wheelhouse/*.whl
- name: Install and test wheel
run: |
cd $HOME
virtualenv $HOME/venv
source $HOME/venv/bin/activate && pip install --find-links=${{ github.workspace }}/wheelhouse arcae[test]
source $HOME/venv/bin/activate && py.test -s -vvv --pyargs arcae
upload-to-test-pypi:
name: Upload release to Test PyPI
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: release-test
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: dist
- name: List artifacts
run: ls -lh dist
- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
continue-on-error: true
upload-to-pypi:
name: Upload release to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: dist
- name: List artifacts
run: ls -lh dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1