-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (203 loc) · 7.82 KB
/
build-model-builder.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Build ModelBuilder
on:
workflow_dispatch:
inputs:
NEW_RELEASE_TAG:
description: 'Tag for new release'
required: true
jobs:
build-mac:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install swift
run: |
swift --version
brew uninstall swift
swift --version
curl -o swift.pkg https://download.swift.org/swift-6.0-branch/xcode/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-osx.pkg
sudo installer -pkg swift.pkg -target /
echo "Instalación completa"
# https://download.swift.org/swift-6.0-branch/xcode/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-osx.pkg
# brew install swift
swift --version
- name: Build program
run: |
swift --version
echo "building"
swift build -c release
ls .build
echo "ls .build/release"
ls .build/release
ls DAMEERRORAQUI
- uses: actions/upload-artifact@v4
with:
name: mac-output
path: pp
build-linux:
needs: build-mac
runs-on: ubuntu-22.04 # specific version because swift and static swift sdk depend on specfic version of ubuntu
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencias for swift compiler # https://www.swift.org/install/linux/tarball/ Instructions depends on version of Ubuntu
run: |
sudo apt-get update
sudo apt-get install \
binutils \
git \
gnupg2 \
libc6-dev \
libcurl4-openssl-dev \
libedit2 \
libgcc-11-dev \
libpython3-dev \
libsqlite3-0 \
libstdc++-11-dev \
libxml2-dev \
libz3-dev \
pkg-config \
python3-lldb-13 \
tzdata \
unzip \
zlib1g-dev
- name: Download swift
run: |
curl -L -o swift.tar.gz https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04.tar.gz
curl -L -o swift.tar.gz.sig https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04.tar.gz.sig
- name: Verify swift
run: |
gpg --keyserver hkp://keyserver.ubuntu.com \
--recv-keys \
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561'\
'E813 C892 820A 6FA1 3755 B268 F167 DF1A CF9C E069'
gpg --keyserver hkp://keyserver.ubuntu.com --refresh-keys Swift
gpg --verify swift.tar.gz.sig swift.tar.gz
- name: Install swift
run: |
mkdir temp && tar -xzf swift.tar.gz -C temp
#mv temp/*/* ./ # Mueve los archivos de la carpeta interna al directorio actual
ls temp/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04/
which swift
sudo cp -fr temp/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu22.04/usr/* /usr/local/
PWD=`pwd`
#SWIFT_PATH="${PWD}/usr/bin"
#echo "${SWIFT_PATH}" >> $GITHUB_PATH
#export PATH="${SWIFT_PATH}:${PATH}" # the currently running action cannot access the updated path variable.
swift --version
- name: Install static linux sdk
run: |
swift sdk install https://download.swift.org/swift-6.0-branch/static-sdk/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a_static-linux-0.0.1.artifactbundle.tar.gz --checksum 42a361e1a240e97e4bb3a388f2f947409011dcd3d3f20b396c28999e9736df36
swift sdk list
- name: Build program
run: |
swift --version
echo "building"
swift build -c release --swift-sdk swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a_static-linux-0.0.1
echo "ls .build"
ls .build
echo "ls .build/release"
ls .build/release
- uses: actions/upload-artifact@v4
with:
name: linux-output
path: .build/release/ModelBuilder
build-release:
needs: [build-mac, build-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download mac artifact
uses: actions/download-artifact@v4
with:
name: mac-output
path: binaries/macos
- name: Download linux artifact
uses: actions/download-artifact@v4
with:
name: linux-output
path: binaries/linux
merge-multiple: true
- name: Prepare info.json file
run: |
json_content='{
"schemaVersion": "1.0",
"artifacts": {
"model-builder": {
"type": "executable",
"version": "1.0.0",
"variants": [
{
"path": "macos/model-builder_macos_universal",
"supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"]
},
{
"path": "linux/model-builder_linux_x86_64",
"supportedTriples": ["x86_64-unknown-linux-gnu"]
}
]
}
}
}'
echo "json_content=$json_content" >> $GITHUB_ENV
- name: Build zip
run: |
echo "ls"
ls
echo "ls linux"
ls binaries/linux
echo "ls mac"
ls binaries/macos
cd binaries
mv linux/ModelBuilder linux/model-builder_linux_x86_64
echo "$json_content" > info.json
cd ..
echo "ls"
ls
echo "ls linux"
ls binaries/linux
echo "ls mac"
ls binaries/macos
#tar -czvf model-builder.tar.gz binaries/
zip -r model-builder.artifactbundle.zip binaries/
echo "Compression done"
pwd
ls
- name: COMPUTE CRC
run: |
CRC=$(swift package compute-checksum model-builder.artifactbundle.zip)
echo "CRC=$CRC" >> $GITHUB_ENV
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# - name: Get version from package.json
# id: get_version
# run: |
# # $(jq -r '.version' package.json)
# VERSION="1.0.1"
# echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create tag
run: |
TAGNAME="${{ github.event.inputs.NEW_RELEASE_TAG }}"
echo "TAGNAME=$TAGNAME" >> $GITHUB_ENV
git tag -a "$TAGNAME" -m "Release version $TAGNAME"
git push origin "$TAGNAME"
#git tag -a "v${{ env.VERSION }}" -m "Release version ${{ env.VERSION }}"
#git push origin "v${{ env.VERSION }}"
- name: Create release
id: create-release
uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
with:
name: 'ModelBuilder linux_x86_64'
tag_name: $TAGNAME
body: $CRC
files:
model-builder.artifactbundle.zip
- name: OUTPUT URLs
run: |
echo "URL asset[0]: ${{ fromJSON(steps.create-release.outputs.assets)[0].browser_download_url }}"
echo "URL release: ${{ steps.create-release.outputs.url }}"