Enable VLAB in CI #48
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 | |
# we need to have runner(1001) on host we right permissions | |
# sudo usermod -aG kvm runner | |
# and load needed modules (on the host) | |
# sudo modprobe nbd | |
#sudo usermod -aG kvm runner | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to lab registry | |
uses: docker/login-action@v3 | |
with: | |
registry: m.l.hhdev.io:31000 | |
username: lab | |
password: ${{ secrets.LAB_REGISTRY_TOKEN }} | |
- name: hhfab init and build | |
run: | | |
export XDG_CONFIG_HOME=$(pwd) | |
export HHFAB_BASE_REPO=m.l.hhdev.io:31000/githedgehog | |
bin/hhfab init -p vlab -v | |
bin/hhfab build -v | |
ls -lah .hhfab | |
bin/hhfab vlab up -v --dry-run | |
sudo bin/hhfab vlab up -v --install-complete | |
- name: Setup tmate session for debug | |
# TODO | |
# Get back to: && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
if: ${{ failure() }} | |
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 |