-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move to using local reusable workflow
libbuild.yml
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Build boxes | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build-os-version: | ||
required: true | ||
type: string | ||
description: The OS version to build (must match a value in the local file `os_vers`) | ||
build-runner: | ||
type: string | ||
default: macos-12 | ||
build-type: | ||
required: true | ||
type: string | ||
description: The VM system type to build (must match a value in the local file `builds`) | ||
timeout-minutes: | ||
type: number | ||
default: 30 | ||
description: A timeout value in minutes for the whole job to complete | ||
upload-box: | ||
type: boolean | ||
default: true | ||
|
||
jobs: | ||
run-packer: | ||
name: Build & test box | ||
runs-on: ${{ inputs.build-runner }} | ||
timeout-minutes: ${{ inputs.timeout-minutes }} | ||
env: | ||
MAKE_VARS: "" | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 | ||
- name: Debug on runner (When re-run with "Enable debug logging" checked) | ||
if: runner.debug | ||
uses: mxschmitt/action-tmate@a283f9441d2d96eb62436dc46d7014f5d357ac22 # v3 | ||
with: | ||
detached: true | ||
- name: Install virtualisation software | ||
env: | ||
TECHNEG_VAGRANT_PROVIDER: ${{ startsWith(inputs.build-type, 'qemu') && 'qemu-system-x86' || 'virtualbox' }} | ||
if: ${{ !startsWith(runner.name, 'self') }} | ||
run: | | ||
kernel_name=$(uname -s) | ||
if [ "$kernel_name" == "Linux" ]; then | ||
sudo apt update | ||
sudo apt --yes install vagrant $TECHNEG_VAGRANT_PROVIDER | ||
elif [ "$kernel_name" == "Darwin" ]; then | ||
brew update | ||
brew install make | ||
fi | ||
- name: Prepare environment | ||
if: startsWith(inputs.build-type, 'qemu') | ||
run: | | ||
kernel_name=$(uname -s) | ||
if [ "$kernel_name" == "Linux" ]; then | ||
echo PKR_VAR_accelerator=kvm >> $GITHUB_ENV | ||
fi | ||
- name: Run Packer | ||
id: packer | ||
env: | ||
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gmake ${{ env.MAKE_VARS }} -f ${{ inputs.build-type }}/Makefile ${{ inputs.build-os-version }} | ||
- name: Prepare Vagrant | ||
if: startsWith(inputs.build-type, 'qemu') | ||
run: vagrant plugin install vagrant-qemu | ||
- name: Install Test Kitchen | ||
if: ${{ !startsWith(runner.name, 'self') }} | ||
run: | | ||
echo ::group::Installing Chef Workstation | ||
kernel_name=$(uname -s) | ||
if [ "$kernel_name" == "Linux" ]; then | ||
wget --no-verbose https://packages.chef.io/files/stable/chef-workstation/23.7.1042/ubuntu/22.04/chef-workstation_23.7.1042-1_amd64.deb | ||
sudo dpkg --install chef-workstation_23.7.1042-1_amd64.deb | ||
elif [ "$kernel_name" == "Darwin" ]; then | ||
sudo echo "Refresh sudo cached credential" | ||
brew install chef-workstation | ||
fi | ||
echo ::endgroup:: | ||
chef -v | ||
- name: Prepare Test Kitchen | ||
if: startsWith(inputs.build-type, 'vbox') | ||
run: echo TECHNEG_VAGRANT_PROVIDER=virtualbox >> $GITHUB_ENV | ||
- name: Run Test Kitchen | ||
env: | ||
TECHNEG_VAGRANT_BOX: ${{ steps.packer.outputs.vagrant-box }} | ||
run: kitchen test | ||
- name: Upload to Vagrant Cloud (On GitHub default branch only) | ||
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | ||
env: | ||
PACKER_COMMAND: ${{ inputs.upload-box && 'build -timestamp-ui' || 'validate' }} | ||
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} | ||
run: | | ||
packer $PACKER_COMMAND -only \*.${{ inputs.build-os-version }} -var version=$(bin/version) -var prefix= -var no_release=false -var box_dir=box/${{ inputs.build-type }} upload |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../base/.github/workflows/libbuild.yml |
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