WIP: Raceboat build container #170
Workflow file for this run
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: Continuous Integration | |
on: | |
push: | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
builder-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/raceboat-builder | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{raw}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: Configure Docker Caching | |
id: cache | |
uses: int128/docker-build-cache-config-action@v1 | |
with: | |
image: ghcr.io/${{ github.repository }}/raceboat-builder/cache | |
- name: Build and Push raceboat-builder Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: raceboat-builder-image | |
file: raceboat-builder-image/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: ${{ steps.cache.outputs.cache-from }} | |
cache-to: ${{ steps.cache.outputs.cache-to }} | |
build-framework: | |
needs: [builder-image] | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tst-race/raceboat/raceboat-builder:${{ github.head_ref || github.ref_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
run: ./build.sh | |
- name: Create Build Artifact | |
run: "tar cvf ${{ github.event.repository.name }}.tar.gz -C /__w/raceboat/raceboat/ ./racesdk" | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ github.event.repository.name }}.tar.gz" | |
path: "${{ github.event.repository.name }}.tar.gz" | |
retention-days: 10 | |
compile-image: | |
needs: [build-framework] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Framework Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: "${{ github.event.repository.name }}.tar.gz" | |
- name: debug ls | |
run: ls -R . | |
- name: untar | |
run: tar xf ${{ github.event.repository.name }}.tar.gz | |
- name: debug ls | |
run: ls -R racesdk | |
- name: debu pwdg | |
run: pwd | |
- name: env | |
run: env | |
- name: Log in to Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/raceboat-compile | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{raw}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: Configure Docker Caching | |
id: cache | |
uses: int128/docker-build-cache-config-action@v1 | |
with: | |
image: ghcr.io/${{ github.repository }}/raceboat-compile/cache | |
- name: Build and Push raceboat-compile Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: /home/runner/work/raceboat/raceboat | |
file: raceboat-compile-image/Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: ${{ steps.cache.outputs.cache-from }} | |
cache-to: ${{ steps.cache.outputs.cache-to }} | |
run-tests: | |
needs: [compile-image] | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/tst-race/raceboat/raceboat-compile:${{ github.head_ref || github.ref_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Test | |
run: ./test.sh | |
runtime-image: | |
needs: [compile-image] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download Framework Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: "${{ github.event.repository.name }}.tar.gz" | |
- name: debug ls | |
run: ls -R . | |
- name: untar | |
run: tar xf ${{ github.event.repository.name }}.tar.gz | |
- name: debug ls | |
run: ls -R racesdk | |
- name: debu pwdg | |
run: pwd | |
- name: env | |
run: env | |
- name: Log in to Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }}/raceboat-runtime | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{raw}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: Configure Docker Caching | |
id: cache | |
uses: int128/docker-build-cache-config-action@v1 | |
with: | |
image: ghcr.io/${{ github.repository }}/raceboat-runtime/cache | |
- name: Build and Push raceboat-runtime Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: /home/runner/work/raceboat/raceboat | |
file: raceboat-runtime-image/Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: ${{ steps.cache.outputs.cache-from }} | |
cache-to: ${{ steps.cache.outputs.cache-to }} | |
build-contexts: ghcr.io/tst-race/raceboat/raceboat-compile=docker-image://ghcr.io/tst-race/raceboat/raceboat-compile:${{ steps.meta.outputs.version }} |