forked from scikit-hep/awkward
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (97 loc) · 3.01 KB
/
deploy.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
name: Deploy
on:
workflow_dispatch:
inputs:
publish-pypi:
type: boolean
description: Publish to PyPI
release:
types:
- published
jobs:
determine-source-date-epoch:
name: "Determine SOURCE_DATE_EPOCH"
runs-on: ubuntu-latest
outputs:
source-date-epoch: ${{ steps.log.outputs.source-date-epoch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- id: log
name: Compute SOURCE_DATE_EPOCH
run: |
# Find latest unix timestamp in awkward-cpp, and the kernel generation files
epoch=$( git log -1 --format=%at -- awkward-cpp kernel-specification.yml kernel-test-data.json )
echo "source-date-epoch=$epoch" >> $GITHUB_OUTPUT
check-requirements:
name: "Check awkward requirements"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Check awkward-cpp version matches requirement
run: pipx run nox -s check_cpp_constraint
check-cpp-on-pypi:
name: "Check awkward-cpp dependency on PyPI"
runs-on: ubuntu-latest
needs: [determine-source-date-epoch]
env:
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Prepare build files
run: pipx run nox -s prepare
- name: Build awkward-cpp sdist
run: pipx run build --sdist awkward-cpp
- name: Check sdist matches PyPI
run: pipx run nox -s check_cpp_sdist_released -- awkward-cpp/dist/awkward-cpp*.tar.gz
build:
name: "Build wheel & sdist"
runs-on: ubuntu-latest
needs: [determine-source-date-epoch]
env:
SOURCE_DATE_EPOCH: ${{ needs.determine-source-date-epoch.outputs.source-date-epoch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Prepare build files
run: pipx run nox -s prepare
- name: Build distributions
run: pipx run build --sdist --wheel
- name: Check metadata
run: pipx run twine check dist/*
- uses: actions/upload-artifact@v3
with:
name: distributions
path: dist/*
bundle-headers:
name: "Bundle header-only libraries"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Create archive
run: tar -czvf header-only.tar.gz header-only
- uses: actions/upload-artifact@v3
with:
name: headers
path: header-only.tar.gz
upload:
needs: [build, check-requirements, check-cpp-on-pypi]
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published') || inputs.publish-pypi
steps:
- uses: actions/download-artifact@v3
with:
name: distributions
path: dist
- uses: pypa/gh-action-pypi-publish@v1.6.4
with:
password: ${{ secrets.PYPI_PASSWORD }}