-
Notifications
You must be signed in to change notification settings - Fork 4
172 lines (155 loc) · 6.23 KB
/
build.yml
File metadata and controls
172 lines (155 loc) · 6.23 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
169
170
171
172
name: Build / Release
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15-intel
os: darwin
arch: amd64
- runner: macos-14
os: darwin
arch: arm64
- runner: windows-2022
os: windows
arch: amd64
- runner: ubuntu-22.04
os: linux
arch: amd64
- runner: ubuntu-22.04-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@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: .python-version
# 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: Non-Docker Smoke tests
shell: bash
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_AUTH_TOKEN=${{ secrets.TEST_LOCALSTACK_AUTH_TOKEN }} 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: 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
if: matrix.os != 'windows' && matrix.os != 'darwin'
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 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: |
VERSION_OUTPUT=$(dist-bin/localstack --version)
echo $VERSION_OUTPUT
# using bash parameter expansion to remove the part after the last space, since sed won't work on MacOS
echo "cli_version=${VERSION_OUTPUT##* }" >> $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@v7
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@v7
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@v8
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 }}