build #42
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
name: build | |
run-name: build | |
on: | |
push: | |
branches: ["*"] | |
tags: | |
- "v*" | |
env: | |
FLUTTER_ROOT: dummy | |
DART_VERSION: 3.3.4 | |
jobs: | |
dart-set-image: | |
runs-on: ubuntu-latest | |
outputs: | |
dart_image: ${{ steps.vars.outputs.dart_image }} | |
steps: | |
- id: vars | |
run: echo "dart_image=dart:${DART_VERSION}" >> $GITHUB_OUTPUT | |
tiecd-build-amd64: | |
runs-on: ubuntu-latest | |
needs: dart-set-image | |
container: | |
image: ${{ needs.dart-set-image.outputs.dart_image }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Dart code gen build | |
run: | | |
mkdir -p dist/bin | |
dart pub run flutter_oss_licenses:generate.dart -o dist/oss_licenses.json --json | |
dart run build_runner build | |
- name: Dart executable build | |
run: dart compile exe bin/tiecd.dart -o dist/bin/tiecd | |
- name: Tar artifacts | |
run: | | |
mkdir upload | |
tar -cvzf upload/tiecd-amd64.tgz dist | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-amd64 | |
path: upload | |
retention-days: 1 | |
tiecd-embedded-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Setup tools | |
run: | | |
wget -q https://storage.googleapis.com/dart-archive/channels/stable/release/$DART_VERSION/sdk/dartsdk-linux-x64-release.zip -O dart.zip | |
unzip dart.zip | |
export PATH=`pwd`/dart-sdk/bin:$PATH | |
rm dart.zip | |
dart --disable-analytics | |
- uses: balchua/microk8s-actions@v0.3.2 | |
with: | |
channel: '1.26/stable' | |
addons: '["dns", "rbac", "hostpath-storage", "registry"]' | |
- name: Test MicroK8s | |
run: | | |
kubectl get no | |
kubectl get pods -A -o wide | |
- name: Dart tests | |
run: | | |
PATH=`pwd`/dart-sdk/bin:$PATH | |
dart run build_runner build | |
dart test test | |
tiecd-build-arm64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- run: | | |
docker buildx build -t tiecd/tiecdtarball -f Dockerfile.arm64 --build-arg DART_VERSION=$DART_VERSION --platform linux/arm64 -o type=tar,dest=bins.tar . | |
- name: Exctract artifacts for upload | |
run: | | |
mkdir upload | |
tar -xvf bins.tar -C upload | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-arm64 | |
path: upload | |
retention-days: 1 | |
# single arch images (amd64) using cekit fully | |
image-build-single-arch: | |
runs-on: ubuntu-latest | |
needs: [tiecd-build-amd64,tiecd-embedded-tests] | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ | |
"jdk8","jdk11","jdk17","jdk21","vercel" | |
] | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: build-artifacts-* | |
merge-multiple: true | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/tiecd | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install CEKit | |
uses: cekit/actions-setup-cekit@v1.1.5 | |
- name: Save Tags | |
run: echo "${{ steps.meta.outputs.tags }}" >> tags.txt | |
- name: Save Labels | |
run: echo "${{ steps.meta.outputs.labels }}" >> labels.txt | |
- name: Build ${{ matrix.image }} Image | |
run: scripts/build-image.sh ${{ matrix.image }} | |
# multi arch builds, uses cekit to generate dockerfile, then buildx for actual build | |
# as cekit doesn't currently support buildx | |
image-build-multi-arch: | |
runs-on: ubuntu-latest | |
needs: [tiecd-build-amd64,tiecd-build-arm64,tiecd-embedded-tests] | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ | |
"base","k8s","okd","gke","eks","aks","node18","node20" | |
] | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: build-artifacts-* | |
merge-multiple: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install CEKit | |
uses: cekit/actions-setup-cekit@v1.1.5 | |
- name: Generate Dockerfile for ${{ matrix.image }} image | |
run: scripts/generate-build.sh ${{ matrix.image }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/tiecd | |
labels: | | |
org.opencontainers.image.vendor=Dataaxiom Inc | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
- name: Save Tags | |
run: echo "${{ steps.meta.outputs.tags }}" >> tags.txt | |
- name: Generate Image Tags | |
id: gentags | |
run: | | |
tags=$(scripts/generate-tags.sh ${{ matrix.image }}) | |
echo "tags=$tags" >> $GITHUB_OUTPUT | |
echo Using tags $image_tags | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v5 | |
with: | |
context: target/image | |
push: true | |
platforms: linux/arm64,linux/amd64 | |
provenance: false | |
tags: ${{ steps.gentags.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.labels }} |