self-runner #73
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: self-runner | |
env: | |
default_kernel: 'expk' | |
default_concurrency: '2' | |
default_dockerfile: 'Dockerfile' | |
default_platform: 'linux/amd64' | |
on: | |
workflow_dispatch: | |
inputs: | |
kernel: | |
description: 'HOL kernel' | |
required: true | |
default: 'stdknl' | |
type: choice | |
options: | |
- stdknl | |
- expk | |
- otknl | |
platform: | |
description: 'Platform' | |
required: true | |
default: 'linux/amd64' | |
type: choice | |
options: | |
- linux/386 | |
- linux/amd64 | |
- linux/arm64 | |
concurrency: | |
description: 'Concurrency' | |
required: true | |
default: '2' | |
type: number | |
more-options: | |
description: 'More options' | |
required: false | |
type: string | |
template: | |
description: 'Docker template' | |
required: true | |
default: 'Dockerfile' | |
type: choice | |
options: | |
- Dockerfile | |
- Dockerfile-SMT | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKER_HUB_USERNAME }}/hol-dev | |
tags: | | |
# dynamically set the branch name as a prefix | |
type=sha,prefix={{branch}}-,suffix=-self | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: developers/docker-ci/${{ github.event.inputs.template || env.default_dockerfile }} | |
push: true | |
build-args: | | |
TARGETPLATFORM=${{ github.event.inputs.platform || env.default_platform }} | |
# NOTE: mosml is too slow to be chosen here | |
SML=poly | |
# NOTE: the arg value cannot be quoted here: | |
BUILDOPTS=--${{ github.event.inputs.kernel || env.default_kernel }} -j${{ github.event.inputs.concurrency || env.default_concurrency }} ${{ github.event.inputs.more-options }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |