-
-
Notifications
You must be signed in to change notification settings - Fork 35
158 lines (131 loc) · 4.47 KB
/
build-dev.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
name: Build Dev
on:
workflow_dispatch:
push:
branches-ignore:
- main
env:
GOPRIVATE: github.com/slingdata-io/*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: [self-hosted, linux, ubuntu-16]
timeout-minutes: 5
outputs:
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v2
- name: Set up GoLang
uses: actions/setup-go@v3
with:
go-version: "1.22"
cache: false
- name: Get the version
id: get_version
run: |
VERSION="${GITHUB_REF##*/}.dev"
echo "VERSION -> $VERSION"
DATE=$(date +%F)
VERSION=$(echo $VERSION | sed 's/^v//')
echo "VERSION -> $VERSION"
VERSION="$VERSION/$DATE"
echo "VERSION -> $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- id: step1
name: Build
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
bash scripts/build.sh
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
release:
if: "! (contains(github.event.inputs.build_only, 'true'))"
needs: [build]
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# runner: [self-hosted-mac, self-hosted-linux, self-hosted-windows]
# runner: [macos-latest, ubuntu-20.04, windows-latest]
runner: [self-hosted-mac, ubuntu-16, self-hosted-windows]
# runner: [self-hosted-mac, ubuntu-16]
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: Dump context
env:
JOB_CONTEXT: ${{ toJson(job) }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: |
echo "JOB_CONTEXT -> $JOB_CONTEXT"
echo "MATRIX_CONTEXT -> $MATRIX_CONTEXT"
echo "RUNNER_CONTEXT -> $RUNNER_CONTEXT"
echo "VERSION -> ${{ needs.build.outputs.VERSION }}"
- name: Set up GoLang
uses: actions/setup-go@v3
with:
go-version: "1.22"
cache: false
- name: Load Secrets
uses: flarco/infisical-action@v3
with:
version: 0.28.1
client_id: ${{ secrets.INFISICAL_CLIENT_ID }}
client_secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
use_system_python: true
- name: Build Sling (Linux)
env:
VERSION: ${{ needs.build.outputs.VERSION }}
if: runner.os == 'linux'
run: |
# Prep
bash scripts/ci/prep.linux.sh
# build
bash scripts/ci/build.linux.sh $VERSION
- name: Build Sling (Mac)
env:
VERSION: ${{ needs.build.outputs.VERSION }}
if: runner.os == 'macOS'
run: |
# Prep
bash scripts/ci/prep.mac.sh
# build
bash scripts/ci/build.mac.sh $VERSION
- name: Configure Pagefile (Windows)
if: runner.os == 'windows'
uses: al-cheb/configure-pagefile-action@v1.2
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"
- name: Build Sling (Windows)
env:
VERSION: ${{ needs.build.outputs.VERSION }}
if: runner.os == 'windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
# Prep
.\scripts\ci\prep.win.ps1
# Build
.\scripts\ci\build.win.ps1 $env:VERSION
- name: Upload to R2 (Windows)
if: runner.os == 'windows'
shell: pwsh
run: .\mc.exe cp sling_windows_amd64.tar.gz R2/sling-public/dev/latest/
- name: Upload to R2 (Unix)
if: runner.os != 'windows'
run: mc cp *.tar.gz R2/sling-public/dev/latest/
- name: Purge Cache
if: runner.os == 'linux'
run: |
curl 'https://api.cloudflare.com/client/v4/zones/c4605fd9cf8ddcd00671858bbd16ffac/purge_cache' \
-H "X-Auth-Key: $CF_AUTH_KEY" \
-H "X-Auth-Email: $CF_AUTH_EMAIL" \
--data-raw '{"files":["https://f.slingdata.io/dev/latest/sling_linux_amd64.tar.gz","https://f.slingdata.io/dev/latest/sling_linux_arm64.tar.gz","https://f.slingdata.io/dev/latest/sling_darwin_amd64.tar.gz","https://f.slingdata.io/dev/latest/sling_darwin_arm64.tar.gz","https://f.slingdata.io/dev/latest/sling_windows_amd64.tar.gz"]}'