Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 85 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,59 @@

name: Bazel

# Needed for creating releases
permissions:
contents: write

on:
pull_request: {}
pull_request:
branches: [main]

push: {}
release:
types: [published]
workflow_dispatch:
inputs:
create_release:
description: "Create GitHub release"
type: boolean
default: false
version:
description: "Release version"
required: false
type: string
upload_to_registry:
description: "Upload to package registry"
type: boolean
default: false

jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/bazelisk
~/.cache/bazel
key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }}
restore-keys: bazel-
- run: bazelisk test //...
# FIXME
# build-and-test:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cache/bazelisk
# ~/.cache/bazel
# key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }}
# restore-keys: bazel-
# - run: bazelisk test //...

build-and-upload-tools:
needs: [build-and-test]
# FIXME
# needs: [build-and-test]
strategy:
matrix:
# Only the go_binary targets support cross-compilation at the moment:
target:
- //agent/cmd/agent
- //tools/nbictl/cmd/nbictl
os: [linux, windows, darwin]
# FIXME
# os: [linux, windows, darwin]
os: [linux, darwin]
arch: [amd64, arm64]

runs-on: ubuntu-latest
Expand Down Expand Up @@ -81,23 +105,54 @@ jobs:
with:
name: agent-${{ matrix.os }}-${{ matrix.arch }}
path: bazel-bin/agent/cmd/agent/agent_/agent.exe

# FIXME
# build-and-upload-docs:
# needs: [build-and-test]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/cache@v4
# with:
# path: |
# ~/.cache/bazelisk
# ~/.cache/bazel
# key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }}
# restore-keys: bazel-
# - run: bazelisk build "//api:api.html"
# - name: Upload API docs
# uses: actions/upload-artifact@v4
# with:
# name: api.html
# path: |
# bazel-bin/api/api.html/api.html

build-and-upload-docs:
needs: [build-and-test]
create-release:
needs: [build-and-upload-tools]
runs-on: ubuntu-latest
# FIXME
# if: |
# github.event_name == 'workflow_dispatch' &&
# inputs.create_release == true

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/bazelisk
~/.cache/bazel
key: bazel-${{ hashFiles('common.bazelrc', '.bazelrc', '.bazelversion', 'WORKSPACE', 'MODULE.bazel', 'requirements.txt') }}
restore-keys: bazel-
- run: bazelisk build "//api:api.html"
- name: Upload API docs
uses: actions/upload-artifact@v4

- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: api.html
path: |
bazel-bin/api/api.html/api.html
# FIXME
# tag_name: ${{ inputs.version }}
# name: FIXME Release ${{ inputs.version }}
tag_name: FIXME-test-release-${{ github.ref_name }}
name: FIXME Release ${{ github.ref_name }}
draft: true
files: |
nbictl-*
agent-*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
Loading