-
Notifications
You must be signed in to change notification settings - Fork 3
214 lines (194 loc) · 8.26 KB
/
build.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
name: Build / Release
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: macos-12
os: darwin
arch: amd64
- runner: macos-13-xlarge
os: darwin
arch: arm64
- runner: windows-2019
os: windows
arch: amd64
- runner: ubuntu-20.04
os: linux
arch: amd64
- runner: buildjet-2vcpu-ubuntu-2204-arm
os: linux
arch: arm64
runs-on: ${{ matrix.runner }}
outputs:
cli_version: ${{ steps.cli_version.outputs.cli_version }}
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Setup Python (GitHub Runner)
if: ${{ !contains(matrix.runner, 'buildjet') }}
uses: actions/setup-python@v5
with:
python-version: '3.11.5'
- name: Setup Python (BuildJet Runner)
if: contains(matrix.runner, 'buildjet')
uses: gabrielfalcao/pyenv-action@v18
with:
default: '3.11.4'
# Add a retry to avoid issues when this action is running
# right after the package is published on PyPi
# (and might not be distributed in the CDN yet)
- name: Create virtual environment
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
retry_wait_seconds: 120
command: make clean-venv venv
- name: Build using pyinstaller
shell: bash
run: make clean all
- name: Setup Docker on MacOS
# Install docker and start Colima on MacOS (except it's the large runner)
# GitHub xlarge MacOS runner cannot run Docker containers:
# - https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/
# if: matrix.os == 'darwin' && matrix.runner != 'macos-13-xlarge'
# TODO re-enable when mac11 docker gets more stable
if: ${{ false }}
run: |
brew install docker
colima start
- name: Community Non-Docker Smoke tests
shell: bash
run: |
ls dist-bin/
cd dist-bin
# show the help
./localstack --help
# show the config
./localstack config show
- name: Pro Non-Docker Smoke tests
shell: bash
# Skip these checks for forks (forks do not have access to the LocalStack Pro API key)
if: ${{ ! github.event.pull_request.head.repo.fork }}
run: |
# create an extension with default parameters (enter all new lines to use defaults)
printf "\n\n\n\n\n\n\n\n\n" | LOCALSTACK_API_KEY=${{ secrets.TEST_LOCALSTACK_API_KEY }} DEBUG=1 ./dist-bin/localstack extensions dev new
# print the directory output
ls -al my-localstack-extension
# remove it again
rm -rf my-localstack-extension
- name: Community Docker Smoke tests (Linux, MacOS)
shell: bash
# GitHub Windows and xlarge MacOS runner cannot run Docker containers:
# - https://github.com/orgs/community/discussions/25491
# - https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/
# TODO re-enable for mac when mac11 docker gets more stable, and for buildjet when the tests there get more stable
if: matrix.os != 'windows' && matrix.os != 'darwin' && matrix.runner != 'buildjet-2vcpu-ubuntu-2204-arm'
run: |
# Pull images to avoid making smoke tests vulnerable to system behavior (docker pull speed)
docker pull localstack/localstack
cd dist-bin
# start community
./localstack start -d
./localstack wait -t 180
./localstack status services --format plain
./localstack status services --format plain | grep "s3=available"
./localstack stop
- name: Pro Docker Smoke tests (Linux, MacOS)
shell: bash
# GitHub Windows and xlarge MacOS runner cannot run Docker containers:
# - https://github.com/orgs/community/discussions/25491
# - https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/
# Skip these checks for forks (forks do not have access to the LocalStack Pro API key)
# TODO re-enable for mac when mac11 docker gets more stable, and for buildjet when the tests there get more stable
if: matrix.os != 'windows' && matrix.os != 'darwin' && matrix.runner != 'buildjet-2vcpu-ubuntu-2204-arm' && !github.event.pull_request.head.repo.fork
run: |
# Pull images to avoid making smoke tests vulnerable to system behavior (docker pull speed)
docker pull localstack/localstack-pro
cd dist-bin
# start pro with an API key (legacy)
LOCALSTACK_API_KEY=${{ secrets.TEST_LOCALSTACK_API_KEY }} ./localstack start -d
./localstack wait -t 180
./localstack status services --format plain
./localstack status services --format plain | grep "xray=available"
./localstack stop
# start pro with an auth token and extensions dev mode (see issue #20)
LOCALSTACK_AUTH_TOKEN=${{ secrets.TEST_LOCALSTACK_AUTH_TOKEN }} EXTENSION_DEV_MODE=1 ./localstack start -d
./localstack wait -t 180
./localstack logs | grep "extension developer mode enabled"
./localstack status services --format plain
./localstack status services --format plain | grep "xray=available"
./localstack stop
- name: Set CLI version output
id: cli_version
shell: bash
run: |
dist-bin/localstack --version
echo "cli_version=$(dist-bin/localstack --version)" >> $GITHUB_OUTPUT
- name: Archive distribution (Linux, MacOS)
if: matrix.os != 'windows'
run: |
cd dist-bin/
tar -czf ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile.tar.gz localstack
rm localstack
cd ../dist-dir/
tar -czf ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz localstack
rm -r localstack
- name: Archive distribution (Windows)
if: matrix.os == 'windows'
run: |
cd dist-bin/
Compress-Archive localstack.exe ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile.zip
rm localstack.exe
cd ../dist-dir/
Compress-Archive localstack ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}.zip
rm -r localstack
- name: Upload binary artifacts
uses: actions/upload-artifact@v4
with:
name: ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile
path: 'dist-bin/*'
- name: Upload folder artifacts
uses: actions/upload-artifact@v4
with:
name: ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}
path: 'dist-dir/*'
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
permissions:
contents: write
steps:
- name: Download Builds
uses: actions/download-artifact@v4
with:
path: builds
- name: Generate Checksums
run: |
# move all files from the builds subdirectories to the builds root folder
find ./builds/ -type f -print0 | xargs -0 mv -t ./builds/
# remove all (empty) subdirectories
find ./builds/ -mindepth 1 -maxdepth 1 -type d -print0 | xargs -r0 rm -R
# generate the checksums
cd builds
sha256sum *.{tar.gz,zip} > ${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-checksums.txt
- name: Release
uses: softprops/action-gh-release@v2
with:
files: 'builds/*'
draft: true
token: ${{ secrets.LOCALSTACK_GITHUB_TOKEN }}