Skip to content

Even more work for B1 #1263

Even more work for B1

Even more work for B1 #1263

Workflow file for this run

name: CI
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches:
- master
- release/*
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:
test:
runs-on: ubuntu-latest-x86-4-cores
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: true
- name: Setup Just
uses: extractions/setup-just@v2
- name: GHA Lint
run: |
just --timestamp lint-gha
# Don't remove it! We shouldn't allow CI to pass if there are any changes not committed after running just
- name: Just all autogeneration and fail on dirty
run: |
just --timestamp gen
git status --short
git diff --quiet
- name: Some Go lint
run: |
just --timestamp _lint
- name: More Go lint
uses: golangci/golangci-lint-action@v6
with:
# keep in sync with hack/tools.just
version: v1.61.0
- name: Run tests
run: |
just --timestamp test
- 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
# TODO add a separate full e2e build with USB drive
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os:
# it's needed to test with ghcr.io and not local mirror
- ubuntu-latest-x86-4-cores
- macos-latest
# we can add it if there will be any demand
# - ubuntu-24.04-arm64-4-core
buildmode:
- "--usb=false"
- "--usb=true"
# exclude:
# Not enough disk space
# - os: macos-latest
# buildmode: "--usb=true"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: true
- name: Setup Just
uses: extractions/setup-just@v2
- name: Setup docker on MacOS
if: matrix.os == 'macos-latest'
run: |
brew install docker
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build hhfab for local OS/ARCH
run: |
just hhfab-build-local
- name: hhfab init and build
run: |
bin/hhfab init -v --dev --import-host-upstream
bin/hhfab build -v ${{ matrix.buildmode }}
ls -lah result
- 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
builds:
runs-on: ubuntu-latest
needs:
- build
if: ${{ always() }}
steps:
- run: |
result="${{ needs.build.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
vlab:
runs-on: vlab
needs:
- test
- build
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
fabricmode:
- spine-leaf
- collapsed-core
includeonie:
- "--include-onie=false"
buildmode:
- "--usb=true"
- "--usb=false"
include:
- fabricmode: spine-leaf
includeonie: "--include-onie=true"
buildmode: "--usb=true"
- fabricmode: spine-leaf
includeonie: "--include-onie=true"
buildmode: "--usb=false"
steps:
- name: Runner host
run: |
echo "$KUBE_NODE"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: true
- name: Setup local registry
env:
LOCALREG_SYNC_REGISTRY: m-pub.l.hhdev.io:31000
LOCALREG_SYNC_USERNAME: lab
LOCALREG_SYNC_PASSWORD: ${{ secrets.LAB_REGISTRY_TOKEN }}
run: |
just --timestamp _localreg &
- name: Build hhfab
run: |
just --timestamp oci_repo=127.0.0.1:30000 oci=http push
- name: hhfab init and vlab up
env:
HHFAB_REG_REPO: 127.0.0.1:30000
run: |
bin/hhfab init -v --dev -m ${{ matrix.fabricmode }} ${{ matrix.includeonie }}
bin/hhfab vlab gen -v
bin/hhfab vlab up -v --ready setup-vpcs --ready test-connectivity --ready exit ${{ matrix.buildmode }}
- name: Dump local registry logs
if: ${{ always() }}
run: |
cat .zot/log
- 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
vlabs:
runs-on: ubuntu-latest
needs:
- vlab
if: ${{ always() }}
steps:
- run: |
result="${{ needs.vlab.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
publish:
runs-on: lab
if: startsWith(github.event.ref, 'refs/tags/') && github.event_name == 'push'
needs:
- build
- vlab
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
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: 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