-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (112 loc) Β· 4.11 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
# Do not rename this file. It is used by name in the trusted publisher section
# in pypi.org and test.pypi.org
name: CI
on:
push:
branches:
- '**' # For now, let's build all branches. Roll this back if it gets too slow or we exhaust our quota.
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # Build v1.2.3 tags as well. We'll use tags as the criteria for publishing
pull_request:
branches:
- '**' # * does not match '/' like sm/my-feature
workflow_dispatch: # For manually triggering a build: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch
jobs:
build:
strategy:
matrix:
# We mainly care about hardware rather than OS
# macos-13 is x86
# macos-latest is arm64
# ubuntu-latest is x64
os: [ubuntu-latest, macos-latest, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# Build (and test) Lean. Tests are all via #guard macros
# now so you can't really build without testing.
- uses: leanprover/lean-action@v1
- name: Run Lean tests
run: lake exe klr
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
working-directory: ./interop
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pytest
working-directory: ./interop
run: |
pytest
# Mostly followed guides here:
# - https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file
# - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# NB: I needed to set the trusted publisher to repo NKL, not KLR, since that was its original name. Scary detail! No idea how I'd figure that out without knowing the original name.
publish-to-testpypi:
name: Publish Python π distribution π¦ to TestPyPI
needs:
- build
if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes
runs-on: ubuntu-latest
environment:
name: testpypi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/checkout@v4 # for scripts
- name: Download all the dists
uses: actions/download-artifact@v4
with:
# name: python-package-distributions
# # unpacks all CIBW artifacts into dist/
# pattern: cibw-*
path: dist/
merge-multiple: true
- name: List the wheels
run: |
ls -1 dist/
- name: Rename OSX wheels
working-directory: ./dist
run: ../bin/rename-wheels # .. because we are starting in ./dist
- name: Publish distribution π¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
skip-existing: true
# For this step to succeed, you must have bumped the klr version in interop/pyproject.toml
publish-to-pypi:
name: Publish Python π distribution π¦ to PyPI
needs:
- build
if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/checkout@v4 # for scripts
- name: Download all the dists
uses: actions/download-artifact@v4
with:
# name: python-package-distributions
# # unpacks all CIBW artifacts into dist/
# pattern: cibw-*
path: dist/
merge-multiple: true
- name: List the wheels
run: |
ls -1 dist/
- name: Rename OSX wheels
working-directory: ./dist
run: ../bin/rename-wheels # .. because we are starting in ./dist
- name: Publish distribution π¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true