-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
490 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches-ignore: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REPOSITORY_BASE_PATH: spaceliftbuild | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.ref_type != 'tag' }} | ||
name: 🚧 ${{ matrix.lang }} on ${{ matrix.arch }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 2 # ECR has pretty aggressive rate limiting 😪 | ||
matrix: | ||
arch: [amd64, arm64] | ||
lang: [javascript, python, golang, dotnet] | ||
|
||
env: | ||
BASE_IMAGE_NAME: ${{ (matrix.lang == 'javascript' || matrix.lang == 'golang') && 'runner-pulumi-base-alpine' || 'runner-pulumi-base-debian' }} | ||
MAIN_IMAGE_FULL_NAME: runner-pulumi-${{ matrix.lang }}-${{ matrix.arch }}:${{ github.sha }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@main | ||
|
||
- name: Get latest Pulumi version | ||
id: latest_version | ||
uses: tdemin/find-latest-tag@v1 | ||
with: | ||
repo: https://github.com/pulumi/pulumi.git | ||
tag: 'v[0-9]+.[0-9]+\.[0-9]+' | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
if: matrix.arch == 'arm64' | ||
with: | ||
platforms: linux/arm64 | ||
|
||
# Building doesn't work with buildx here because of | ||
# a stupid behavior: | ||
# https://github.com/moby/moby/issues/42893#issuecomment-1241274246 | ||
# So we use plain docker commands. | ||
|
||
- name: Build base image (Alpine or Debian) | ||
env: | ||
CONTEXT: ${{ (matrix.lang == 'javascript' || matrix.lang == 'golang') && 'base-alpine' || 'base-debian' }} | ||
run: | | ||
docker build \ | ||
--build-arg PULUMI_VERSION=${{ steps.latest_version.outputs.tag }} \ | ||
--build-arg TARGETARCH=${{ matrix.arch }} \ | ||
--platform linux/${{ matrix.arch }} \ | ||
-t ${{ env.REPOSITORY_BASE_PATH }}/${{ env.BASE_IMAGE_NAME }}:${{ github.sha }} \ | ||
$CONTEXT | ||
- name: Build main image | ||
run: | | ||
docker build \ | ||
--build-arg REPOSITORY_BASE_PATH=${{ env.REPOSITORY_BASE_PATH }} \ | ||
--build-arg RELEASE_VERSION=${{ github.sha }} \ | ||
--platform linux/${{ matrix.arch }} \ | ||
-t ${{ env.MAIN_IMAGE_FULL_NAME }} \ | ||
${{ matrix.lang }} | ||
- name: Pulumi binary sanity test | ||
run: | | ||
docker run --rm ${{ env.MAIN_IMAGE_FULL_NAME }} pulumi about | ||
- name: ${{ matrix.lang }} sanity test | ||
run: | | ||
if [ "${{ matrix.lang }}" == "javascript" ]; then | ||
docker run --rm ${{ env.MAIN_IMAGE_FULL_NAME }} node --version | ||
elif [ "${{ matrix.lang }}" == "python" ]; then | ||
docker run --rm ${{ env.MAIN_IMAGE_FULL_NAME }} python --version | ||
elif [ "${{ matrix.lang }}" == "golang" ]; then | ||
docker run --rm ${{ env.MAIN_IMAGE_FULL_NAME }} go version | ||
elif [ "${{ matrix.lang }}" == "dotnet" ]; then | ||
docker run --rm ${{ env.MAIN_IMAGE_FULL_NAME }} dotnet --version | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.