-
Notifications
You must be signed in to change notification settings - Fork 2
168 lines (140 loc) · 4.87 KB
/
Copy pathsolaris-codex.yml
File metadata and controls
168 lines (140 loc) · 4.87 KB
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
name: Solaris Codex
on:
pull_request:
push:
branches: [main]
paths:
- ".github/workflows/solaris-codex.yml"
- "build-codex.sh"
- "build-gn.sh"
- "build-v8.sh"
- "common.sh"
- "prepare-rust.sh"
- "prepare-sources.sh"
- "versions.sh"
- "patches/**"
- "support/**"
workflow_dispatch:
permissions:
contents: read
jobs:
build_on_solaris:
name: Build Solaris x86
runs-on: ubuntu-latest
timeout-minutes: 360
outputs:
version: ${{ steps.metadata.outputs.version }}
tag: ${{ steps.metadata.outputs.tag }}
asset_prefix: ${{ steps.metadata.outputs.asset_prefix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and package inside Solaris VM
uses: vmactions/solaris-vm@v1.3.4
with:
release: "11.4-gcc"
mem: 8192
cpu: 2
usesh: true
sync: nfs
copyback: false
prepare: |
uname -a
zfs set volsize=8g rpool/swap
pkg install developer/llvm/clang
run: |
set -eu
REPO=`pwd`
WORK=/var/tmp/solaris-codex
rm -rf "$WORK"
git clone "$REPO" "$WORK"
cd "$WORK"
export SOLARIS_CODEX_JOBS=1
bash build-codex.sh
build/install/gn/bin/gn --version
test -f build/install/v8/lib/librusty_v8.a
build/install/codex/bin/codex --version
VERSION=`build/install/codex/bin/codex --version | /usr/bin/nawk '
match($0, /[0-9]+(\.[0-9]+)+/) {
print substr($0, RSTART, RLENGTH)
exit
}
'`
test -n "$VERSION"
ASSET_PREFIX=codex-${VERSION}_SunOS-i386
PACKAGE_DIR=/var/tmp/$ASSET_PREFIX
rm -rf "$PACKAGE_DIR"
mkdir -p "$PACKAGE_DIR/bin" "$REPO/archives"
cp build/install/codex/bin/codex "$PACKAGE_DIR/bin/codex"
chmod 0755 "$PACKAGE_DIR/bin/codex"
(
cd /var/tmp
gtar -czf "$REPO/archives/${ASSET_PREFIX}.tar.gz" "$ASSET_PREFIX"
)
DIGEST=`/usr/bin/digest -a sha256 "$REPO/archives/${ASSET_PREFIX}.tar.gz"`
printf '%s %s\n' "$DIGEST" "${ASSET_PREFIX}.tar.gz" \
> "$REPO/archives/${ASSET_PREFIX}.tar.gz.sha256"
{
printf 'VERSION=%s\n' "$VERSION"
printf 'TAG=codex-%s\n' "$VERSION"
printf 'ASSET_PREFIX=%s\n' "$ASSET_PREFIX"
} > "$REPO/archives/version.env"
- name: Read build metadata
id: metadata
run: |
set -euo pipefail
. archives/version.env
{
printf 'version=%s\n' "$VERSION"
printf 'tag=%s\n' "$TAG"
printf 'asset_prefix=%s\n' "$ASSET_PREFIX"
} >> "$GITHUB_OUTPUT"
- name: Upload release staging artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: solaris-codex-${{ steps.metadata.outputs.version }}
path: |
archives/${{ steps.metadata.outputs.asset_prefix }}.tar.gz
archives/${{ steps.metadata.outputs.asset_prefix }}.tar.gz.sha256
archives/version.env
if-no-files-found: error
retention-days: 7
publish-release:
name: Publish GitHub release
if: github.event_name == 'workflow_dispatch'
needs: build_on_solaris
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download release staging artifact
uses: actions/download-artifact@v4
with:
name: solaris-codex-${{ needs.build_on_solaris.outputs.version }}
path: archives
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
. archives/version.env
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f -a "$TAG" -m "Codex $VERSION for Solaris i386"
git push --force origin "refs/tags/$TAG"
NOTES="Solaris i386 Codex $VERSION binary built by GitHub Actions."
TARBALL="archives/${ASSET_PREFIX}.tar.gz"
CHECKSUM="archives/${ASSET_PREFIX}.tar.gz.sha256"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" \
--title "Codex $VERSION for Solaris i386" \
--notes "$NOTES"
gh release upload "$TAG" "$TARBALL" "$CHECKSUM" --clobber
else
gh release create "$TAG" "$TARBALL" "$CHECKSUM" \
--title "Codex $VERSION for Solaris i386" \
--notes "$NOTES"
fi