|
1 | | -name: Build with pyinstaller |
| 1 | +name: Build / Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | pull_request: |
|
7 | 7 | push: |
8 | 8 | branches: |
9 | 9 | - main |
| 10 | + tags: |
| 11 | + - '*' |
| 12 | + workflow_dispatch: |
10 | 13 |
|
11 | 14 | jobs: |
12 | | - release: |
13 | | - runs-on: ${{ matrix.os }} |
14 | | - |
| 15 | + build: |
15 | 16 | strategy: |
16 | 17 | matrix: |
17 | | - os: [macos-10.15, windows-latest, ubuntu-latest] |
| 18 | + include: |
| 19 | + - runner: macos-11 |
| 20 | + os: darwin |
| 21 | + arch: amd64 |
| 22 | + - runner: windows-2019 |
| 23 | + os: windows |
| 24 | + arch: amd64 |
| 25 | + - runner: ubuntu-20.04 |
| 26 | + os: linux |
| 27 | + arch: amd64 |
| 28 | + - runner: buildjet-2vcpu-ubuntu-2204-arm |
| 29 | + os: linux |
| 30 | + arch: arm64 |
18 | 31 |
|
| 32 | + runs-on: ${{ matrix.runner }} |
| 33 | + outputs: |
| 34 | + cli_version: ${{ steps.cli_version.outputs.cli_version }} |
19 | 35 | steps: |
20 | 36 | - name: Check out Git repository |
21 | | - uses: actions/checkout@v1 |
| 37 | + uses: actions/checkout@v3 |
| 38 | + |
| 39 | + - name: Setup Python (GitHub Runner) |
| 40 | + if: ${{ !contains(matrix.runner, 'buildjet') }} |
| 41 | + uses: actions/setup-python@v4 |
| 42 | + with: |
| 43 | + python-version: '3.10.11' |
| 44 | + |
| 45 | + - name: Setup Python (BuildJet Runner) |
| 46 | + if: contains(matrix.runner, 'buildjet') |
| 47 | + uses: gabrielfalcao/pyenv-action@v14 |
| 48 | + with: |
| 49 | + default: '3.10.11' |
22 | 50 |
|
23 | 51 | - name: Create virtual environment |
24 | 52 | run: make venv |
25 | 53 |
|
26 | 54 | - name: Build using pyinstaller |
27 | | - run: make build |
| 55 | + shell: bash |
| 56 | + run: make clean all |
28 | 57 |
|
29 | | - - name: Smoke test |
| 58 | + - name: Setup Docker on MacOS |
| 59 | + if: matrix.os == 'darwin' |
30 | 60 | run: | |
31 | | - ls dist/localstack |
32 | | - dist/localstack/localstack --help |
33 | | - dist/localstack/localstack config show |
| 61 | + brew install docker |
| 62 | + colima start |
| 63 | +
|
| 64 | + - name: Non-Docker Smoke tests |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + ls dist-bin/ |
| 68 | + cd dist-bin |
| 69 | + # show the help |
| 70 | + ./localstack --help |
| 71 | + # show the config |
| 72 | + ./localstack config show |
| 73 | +
|
| 74 | + - name: Community Docker Smoke tests (Linux, MacOS) |
| 75 | + shell: bash |
| 76 | + # GitHub Windows runner cannot run Docker containers (https://github.com/orgs/community/discussions/25491) |
| 77 | + # Skip these checks for forks (forks do not have access to the LocalStack Pro API key) |
| 78 | + if: matrix.os != 'windows' && !github.event.pull_request.head.repo.fork |
| 79 | + run: | |
| 80 | + # Pull images to avoid making smoke tests vulnerable to system behavior (docker pull speed) |
| 81 | + docker pull localstack/localstack |
| 82 | + cd dist-bin |
| 83 | + # start community |
| 84 | + ./localstack start -d |
| 85 | + ./localstack wait -t 60 |
| 86 | + ./localstack status services --format plain |
| 87 | + ./localstack status services --format plain | grep "s3=available" |
| 88 | + ./localstack stop |
| 89 | +
|
| 90 | + - name: Pro Docker Smoke tests (Linux, MacOS) |
| 91 | + shell: bash |
| 92 | + # GitHub Windows runner cannot run Docker containers (https://github.com/orgs/community/discussions/25491) |
| 93 | + # Skip these checks for forks (forks do not have access to the LocalStack Pro API key) |
| 94 | + if: matrix.os != 'windows' && !github.event.pull_request.head.repo.fork |
| 95 | + run: | |
| 96 | + # Pull images to avoid making smoke tests vulnerable to system behavior (docker pull speed) |
| 97 | + docker pull localstack/localstack-pro |
| 98 | + cd dist-bin |
| 99 | + # start pro |
| 100 | + LOCALSTACK_API_KEY=${{ secrets.TEST_LOCALSTACK_API_KEY }} ./localstack start -d |
| 101 | + ./localstack wait -t 60 |
| 102 | + ./localstack status services --format plain |
| 103 | + ./localstack status services --format plain | grep "xray=available" |
| 104 | + ./localstack stop |
34 | 105 |
|
35 | 106 | - name: Set CLI version output |
36 | 107 | id: cli_version |
| 108 | + shell: bash |
| 109 | + run: | |
| 110 | + dist-bin/localstack --version |
| 111 | + echo "cli_version=$(dist-bin/localstack --version)" >> $GITHUB_OUTPUT |
| 112 | +
|
| 113 | + - name: Archive distribution (Linux, MacOS) |
| 114 | + if: matrix.os != 'windows' |
| 115 | + run: | |
| 116 | + cd dist-bin/ |
| 117 | + tar -czf ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile.tar.gz localstack |
| 118 | + rm localstack |
| 119 | + cd ../dist-dir/ |
| 120 | + tar -czf ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz localstack |
| 121 | + rm -r localstack |
| 122 | +
|
| 123 | + - name: Archive distribution (Windows) |
| 124 | + if: matrix.os == 'windows' |
| 125 | + run: | |
| 126 | + cd dist-bin/ |
| 127 | + Compress-Archive localstack.exe ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}.zip |
| 128 | + rm localstack.exe |
| 129 | + cd ../dist-dir/ |
| 130 | + Compress-Archive localstack ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile.zip |
| 131 | + rm -r localstack |
| 132 | +
|
| 133 | + - name: Upload binary artifacts |
| 134 | + uses: actions/upload-artifact@v3 |
| 135 | + with: |
| 136 | + name: ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }}-onefile |
| 137 | + path: 'dist-bin/*' |
| 138 | + |
| 139 | + - name: Upload folder artifacts |
| 140 | + uses: actions/upload-artifact@v3 |
| 141 | + with: |
| 142 | + name: ${{github.event.repository.name}}-${{steps.cli_version.outputs.cli_version}}-${{ matrix.os }}-${{ matrix.arch }} |
| 143 | + path: 'dist-dir/*' |
| 144 | + |
| 145 | + release: |
| 146 | + runs-on: ubuntu-latest |
| 147 | + if: startsWith(github.ref, 'refs/tags/') |
| 148 | + needs: |
| 149 | + - build |
| 150 | + permissions: |
| 151 | + contents: write |
| 152 | + steps: |
| 153 | + - name: Download Builds |
| 154 | + uses: actions/download-artifact@v3 |
| 155 | + with: |
| 156 | + path: builds |
| 157 | + |
| 158 | + # TODO remove this section once we have native darwin arm64 builds |
| 159 | + # This step is currently necessary for the homebrew action to pick up the MacOS AMD64 package for MacOS ARM64 / M1 |
| 160 | + # GitHub Roadmap: https://github.com/github/roadmap/issues/528 |
| 161 | + - name: (Intermediate) Use Darwin AMD64 for Darwin ARM64 |
37 | 162 | run: | |
38 | | - dist/localstack/localstack --version |
39 | | - echo "::set-output name=number::$(dist/localstack/localstack --version)" |
| 163 | + cp ./builds/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-amd64/* ./builds/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-amd64/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-arm64.tar.gz |
| 164 | + cp ./builds/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-amd64-onefile/* ./builds/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-amd64-onefile/${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-darwin-arm64-onefile.tar.gz |
40 | 165 |
|
41 | | - - name: Archive distribution |
| 166 | + - name: Generate Checksums |
42 | 167 | run: | |
43 | | - cd dist/ |
44 | | - tar -czf localstack-cli-${{steps.cli_version.outputs.number}}-${{ matrix.os }}.tar.gz localstack |
| 168 | + # move all files from the builds subdirectories to the builds root folder |
| 169 | + find ./builds/ -type f -print0 | xargs -0 mv -t ./builds/ |
| 170 | + # remove all (empty) subdirectories |
| 171 | + find ./builds/ -mindepth 1 -maxdepth 1 -type d -print0 | xargs -r0 rm -R |
| 172 | + # generate the checksums |
| 173 | + cd builds |
| 174 | + sha256sum *.{tar.gz,zip} > ${{github.event.repository.name}}-${{needs.build.outputs.cli_version}}-checksums.txt |
45 | 175 |
|
46 | | - - name: Upload artifacts |
47 | | - uses: actions/upload-artifact@v2 |
| 176 | + - name: Release |
| 177 | + uses: softprops/action-gh-release@v1 |
48 | 178 | with: |
49 | | - name: localstack-cli-${{steps.cli_version.outputs.number}}-${{ matrix.os }} |
50 | | - path: dist/localstack-cli-${{steps.cli_version.outputs.number}}-${{ matrix.os }}.tar.gz |
| 179 | + files: 'builds/*' |
| 180 | + draft: true |
| 181 | + token: ${{ secrets.LOCALSTACK_GITHUB_TOKEN }} |
0 commit comments