Enable VLAB in CI #35
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: CI | |
concurrency: | |
group: ci-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
pull_request: | |
schedule: | |
- cron: "0 10 * * *" # ~2am PST | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
required: false | |
default: false | |
jobs: | |
# cache-tools: | |
# runs-on: ubuntu-latest # It should be faster than running in hour DC | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Setup Go | |
# uses: actions/setup-go@v4 | |
# with: | |
# go-version: stable | |
# cache: true | |
# - name: Cache dev tools | |
# uses: actions/cache@v3 | |
# with: | |
# path: bin | |
# key: bin-${{ hashFiles('hack/tools.mk') }} | |
# - name: Prepare all dev tools | |
# run: | | |
# make tools | |
# - name: Setup tmate session for debug | |
# if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
# uses: mxschmitt/action-tmate@v3 | |
# timeout-minutes: 30 | |
# with: | |
# limit-access-to-actor: true | |
build: | |
# runs-on: ["lab", "dind", "jammy"] | |
runs-on: ubuntu-latest | |
# needs: | |
# - cache-tools | |
strategy: | |
matrix: | |
preset: | |
- lab | |
- vlab | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
cache: true | |
- name: Setup git for private Go modules | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
run: git config --global url.https://[email protected]/.insteadOf https://github.com/ | |
- name: Build all | |
run: | | |
make build | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: hhfab init and build | |
run: | | |
bin/hhfab init -p ${{ matrix.preset }} | |
bin/hhfab build -v | |
ls -lah .hhfab | |
- name: Setup tmate session for debug | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 30 | |
with: | |
limit-access-to-actor: true | |
vlab: | |
runs-on: ["vlab"] | |
# needs: | |
# - cache-tools | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
cache: true | |
- name: Setup git for private Go modules | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
run: git config --global url.https://[email protected]/.insteadOf https://github.com/ | |
- name: Build all | |
run: | | |
make build | |
- name: VLAB deps | |
run: | | |
sudo apt update | |
sudo apt install -y qemu-kvm swtpm-tools tpm2-tools socat openssh-client | |
sudo modprobe nbd | |
id -u | |
id -u -n | |
# sudo usermod -aG kvm $USER | |
# newgrp kvm | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# TODO enable local pull-through cache | |
- name: hhfab init and build | |
run: | | |
export XDG_CONFIG_HOME=$(pwd) | |
bin/hhfab init -p vlab -v | |
bin/hhfab build -v | |
ls -lah .hhfab | |
bin/hhfab vlab up -v | |
- name: Setup tmate session for debug | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 30 | |
with: | |
limit-access-to-actor: true | |
publish: | |
# runs-on: ["lab", "simple", "jammy"] | |
runs-on: ubuntu-latest | |
if: startsWith(github.event.ref, 'refs/tags/') && github.event_name == 'push' | |
needs: | |
# - cache-tools | |
- build | |
- vlab | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
cache: true | |
# - name: Cache dev tools | |
# uses: actions/cache@v3 | |
# with: | |
# path: bin | |
# key: bin-${{ hashFiles('hack/tools.mk') }} | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup git for private Go modules | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
run: git config --global url.https://[email protected]/.insteadOf https://github.com/ | |
- name: Publish Images, Helm charts and Bins on release | |
run: | | |
OCI_REPO=ghcr.io/githedgehog/fabricator make push | |
- name: Setup tmate session for debug | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 30 | |
with: | |
limit-access-to-actor: true |