-
Notifications
You must be signed in to change notification settings - Fork 1
203 lines (176 loc) · 7.46 KB
/
dkml.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
##########################################################################
# File: dktool/cmake/scripts/dkml/workflow/compilers-github-workflows-dkml.in.yml#
# #
# Copyright 2022 Diskuv, Inc. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or #
# implied. See the License for the specific language governing #
# permissions and limitations under the License. #
# #
##########################################################################
# Updating
# --------
#
# 1. Delete this file.
# 2. Run dk with your original arguments:
# ./dk dkml.workflow.compilers CI GitHub GitLab Desktop
# or get help to come up with new arguments:
# ./dk dkml.workflow.compilers HELP
name: Build with DkML compiler
on:
# trigger on any push
push:
# ... or trigger manually from GitHub web interface
workflow_dispatch:
inputs:
DISKUV_OPAM_REPOSITORY:
description: The tag for https://github.com/diskuv/diskuv-opam-repository.git. Use "main" to get the latest diskuv repository
type: string
DKML_COMPILER:
description: The tag for https://github.com/diskuv/dkml-compiler.git. Use "main" to get the latest diskuv repository
type: string
env:
DISKUV_OPAM_REPOSITORY: ${{ github.event.inputs.DISKUV_OPAM_REPOSITORY }}
DKML_COMPILER: ${{ github.event.inputs.DKML_COMPILER }}
jobs:
build:
strategy:
matrix:
include: #
- gh_os: windows-2019
abi_pattern: win32-windows_x86
dkml_host_abi: windows_x86
bits: "32"
- gh_os: windows-2019
abi_pattern: win32-windows_x86_64
dkml_host_abi: windows_x86_64
bits: "64"
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86
dkml_host_abi: linux_x86
bits: "32"
- gh_os: ubuntu-latest
abi_pattern: manylinux2014-linux_x86_64
dkml_host_abi: linux_x86_64
bits: "64"
- gh_os: macos-latest
abi_pattern: macos-darwin_all-intel # Hardcoded in DkML compilers before 2.1.2
dkml_host_abi: darwin_arm64
bits: "64"
runs-on: ${{ matrix.gh_os }}
name: build / ${{ matrix.abi_pattern }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache DkML compilers code
uses: actions/cache@v4
id: cache-dkml-compilers
with:
path: .ci/dkml-compilers
key: ${{ runner.os }}
- name: Checkout DkML compilers code
if: steps.cache-dkml-compilers.outputs.cache-hit != 'true'
# For help: ./dk dkml.workflow.compilers HELP
# It is rarely a good idea to use PRERELEASE because the dkml-component-opam
# CI release _is_ the bootstrap opam downloaded by dkml.workflow.compilers.
# So keep using a stable (non-PRERELEASE) bootstrap opam.
run: ./dk dkml.workflow.compilers CI GitHub
# The .ci/dkml-compilers "pre" actions will create the environment variables:
# opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more)
#
- name: Setup DkML compilers on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./.ci/dkml-compilers/gh-windows/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }}
- name: Setup DkML compilers on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./.ci/dkml-compilers/gh-linux/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }}
- name: Setup DkML compilers on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./.ci/dkml-compilers/gh-darwin/pre
with:
DKML_COMPILER: ${{ env.DKML_COMPILER }}
CACHE_PREFIX: ${{ env.CACHE_PREFIX }}
DISKUV_OPAM_REPOSITORY: ${{ env.DISKUV_OPAM_REPOSITORY }}
# This section is for your own build logic which you should place in
# ci/build-test.sh or a similar file
- name: Build and test on Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
shell: msys2 {0}
env:
# [bits] is not populated by .ci/dkml-compilers pre actions
bits: ${{ matrix.bits }}
run: ci/build-test.sh
- name: Build and test on non-Windows host
if: "!startsWith(matrix.dkml_host_abi, 'windows_')"
env:
# [bits] is not populated by .ci/dkml-compilers pre actions
bits: ${{ matrix.bits }}
run: sh ci/build-test.sh
# Upload
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.abi_pattern }}
path: dist/${{ matrix.abi_pattern }}.tar.gz
# The .ci/dkml-compilers "post" actions will finalize caching, etc.
- name: Teardown DkML compilers on a Windows host
if: startsWith(matrix.dkml_host_abi, 'windows_')
uses: ./.ci/dkml-compilers/gh-windows/post
- name: Teardown DkML compilers on a Darwin host
if: startsWith(matrix.dkml_host_abi, 'darwin_')
uses: ./.ci/dkml-compilers/gh-darwin/post
- name: Teardown DkML compilers on a Linux host
if: startsWith(matrix.dkml_host_abi, 'linux_')
uses: ./.ci/dkml-compilers/gh-linux/post
release:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for softprops/action-gh-release@v1
needs:
- build
env:
COMPONENT: dkml-component-staging-opam
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Remove unneeded artifacts
run: rm -rf setup-*
working-directory: dist
- name: Display structure of downloaded files
run: ls -R
working-directory: dist
- name: Restructure multi-ABI files
run: |
_asset="$(pwd)/_asset"
install -d "$_asset"
cd dist
find . -mindepth 1 -maxdepth 1 -type d | while read -r distname; do
tar xvCfz "$_asset" $distname/$distname.tar.gz
rm -f $distname/$distname.tar.gz
done
- name: Display restructured files
run: ls -R
working-directory: _asset
- name: Bundle up multi-ABI asset
run: tar cvCfz _asset $GITHUB_WORKSPACE/$COMPONENT.tar.gz .
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.COMPONENT }}.tar.gz