-
Notifications
You must be signed in to change notification settings - Fork 10
145 lines (119 loc) · 3.85 KB
/
build.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
name: Main workflow
on:
pull_request:
push:
schedule:
- cron: '5 14 * * *'
jobs:
check-version-numbers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check version numbers
run: ./version.sh
package-python:
strategy:
fail-fast: false
matrix:
os:
- macos-11
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies (libtool, aclocal, autoconf)
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt-get install libtool automake
elif [ "$RUNNER_OS" = "macOS" ]; then
brew install libtool autoconf automake
else
echo Unsupported RUNNER_OS=$RUNNER_OS
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
- name: Build wheels
uses: pypa/[email protected]
- name: Upload binary wheel
uses: actions/upload-artifact@v2
with:
name: ${{ format('bdist.{0}', matrix.os) }}
path: wheelhouse/libdash-*.whl
- name: Build source distribution (Linux only)
if: contains(matrix.os, 'ubuntu')
run: python setup.py sdist
- name: Upload source distribution (from Linux)
uses: actions/upload-artifact@v2
if: contains(matrix.os, 'ubuntu')
with:
name: sdist
path: dist/libdash-*.tar.gz
build-both-and-compare:
strategy:
fail-fast: true
matrix:
os:
- macos-12
- macos-11
- ubuntu-latest
ocaml-compiler:
- 4.14.x
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install and test OCaml bindings
run: opam install --with-test --working-dir .
# we don't reuse the wheels so that all of the CI runs can happen concurrently
- name: Install Python directly
run: sudo pip3 install .
- name: Test Python bindings
run: make -C python test
- name: Compare OCaml and Python bindings
run: opam exec -- make -C test test
deploy:
needs:
- check-version-numbers
- package-python
- build-both-and-compare
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')
steps:
- name: Download distributions
uses: actions/download-artifact@v2
- name: Rename distributions
run: |
mkdir dist
ls bdist.*/
mv bdist.*/libdash-*.whl dist/
mv sdist/libdash-*.tar.gz dist/
echo Look on my Works, ye Mighty, and despair!
ls dist
- name: Deploy 'latest' release on GH
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Python source and binary distributions"
files: |
dist/*
- name: Deploy test distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
verbose: true
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Deploy tagged release on PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true