Test on SHR (#15)

* Test on SHR

* Fix name? Maybe?

* Restore proper Bash syntax

* Simplify build

* Pin to Isaiah

* Update to checktout v4

* Bring back the caching

* Set plugin path locally

* Separate jobs, just so I can handle this

* Allow easier target switching

* Test just qemu

* Constrain HTTP ports

* Prevent resource collision for network

* Re-enable building all

* Try only vbox
This commit is contained in:
Greg Hellings
2023-12-12 11:57:09 -06:00
committed by GitHub
parent ebbc8a7371
commit 255f6f68e6
4 changed files with 28 additions and 35 deletions
+13 -30
View File
@@ -9,21 +9,21 @@ name: Build the boxes
pull_request: pull_request:
env: env:
PACKER_PLUGIN_PATH: "~/.config/packer/plugins" PACKER_PLUGIN_PATH: ".config/packer/plugins"
jobs: jobs:
collect: collect:
name: Discover distros name: Discover distros
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
distros: ${{ steps.distros.outputs.distros }} boxen: ${{ steps.distros.outputs.some }}
build: ${{ steps.time.outputs.time }} build: ${{ steps.time.outputs.time }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install python - name: Install python
uses: actions/setup-python@v4 uses: actions/setup-python@v5
with: with:
python-version: 3 python-version: 3
cache: pip cache: pip
@@ -34,7 +34,8 @@ jobs:
run: |- run: |-
set -exo pipefail set -exo pipefail
pip install xonsh PyYAML pip install xonsh PyYAML
echo "distros=$(xonsh build.xsh -a --list)" >> "$GITHUB_OUTPUT" echo "all=$(xonsh build.xsh -a --list)" >> "$GITHUB_OUTPUT"
echo "some=$(xonsh build.xsh -b virtualbox-iso.amd64 -a --list)" >> "$GITHUB_OUTPUT"
- name: Find timestamp for versioning - name: Find timestamp for versioning
id: time id: time
@@ -43,34 +44,16 @@ jobs:
format: 'YYYY.MM.DD.HH' format: 'YYYY.MM.DD.HH'
build: build:
name: Build box name: Build boxes
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
needs: needs:
- collect - collect
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson( needs.collect.outputs.distros ) }} matrix: ${{ fromJson( needs.collect.outputs.boxen ) }}
steps: steps:
- name: Checkout project - name: Checkout project
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Packer and related tools
uses: ./.github/actions/install_packer
- name: Clear disk space
uses: greg-hellings/make-space@main
- name: Output tool versions
shell: bash
run: |
set -x
packer -version
if $(type qemu-system-x86_64); then
qemu-system-x86_64 -version
fi
if $(type VBoxManage); then
VBoxManage --version;
fi
- name: Run generator, if necessary - name: Run generator, if necessary
shell: bash shell: bash
@@ -83,7 +66,7 @@ jobs:
uses: actions/cache/restore@v3 uses: actions/cache/restore@v3
id: cache-restore id: cache-restore
with: with:
path: ${{ runner.os == 'Linux' && '~/.config/packer/plugins' || '/usr/local/bin/github.com' }} path: .config/packer/plugins
key: ${{ runner.os }}-${{ hashFiles('sources/build.pkr.hcl') }} key: ${{ runner.os }}-${{ hashFiles('sources/build.pkr.hcl') }}
- name: Install Packer plugins - name: Install Packer plugins
@@ -94,7 +77,7 @@ jobs:
uses: actions/cache/save@v3 uses: actions/cache/save@v3
if: always() if: always()
with: with:
path: ${{ runner.os == 'Linux' && '~/.config/packer/plugins' || '/usr/local/bin/github.com' }} path: .config/packer/plugins
key: ${{ steps.cache-restore.outputs.cache-primary-key }} key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Build - name: Build
@@ -104,16 +87,16 @@ jobs:
# Add a retry in case something bogus like a network failure happens # Add a retry in case something bogus like a network failure happens
packer build -only="${{ matrix.builder }}" \ packer build -only="${{ matrix.builder }}" \
-var-file="${{ matrix.distro }}" \ -var-file="${{ matrix.distro }}" \
-var "qemu_accelerator=tcg" \
-var "build=${{ needs.collect.outputs.build }}" \ -var "build=${{ needs.collect.outputs.build }}" \
-var "cpu_model=Skylake-Client" \
-var "cpus=2" \ -var "cpus=2" \
-var "memory=4096" \ -var "memory=4096" \
-var "http_port_min=${HTTP_PORT_MIN:-8000}" \
-var "http_port_max=${HTTP_PORT_MAX:-9000}" \
${{ github.event_name != 'release' && '-except=upload' || '' }} \ ${{ github.event_name != 'release' && '-except=upload' || '' }} \
sources sources
env: env:
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
PACKER_LOG: 1 #${{ contains(matrix.needs_timeout, matrix.distro) && '0' || '0' }} PACKER_LOG: 1
- name: Upload artifact - name: Upload artifact
if: ${{ failure() }} if: ${{ failure() }}
+2 -2
View File
@@ -9,7 +9,7 @@ class Provider:
@property @property
def runner(self) -> str: def runner(self) -> str:
if self.name == "qemu": if self.name == "qemu":
return "ubuntu-latest" return "isaiah"
elif self.name.startswith("virtualbox"): elif self.name.startswith("virtualbox"):
return "macos-12" return "isaiah"
return None return None
+10
View File
@@ -74,6 +74,16 @@ variable "http_directory" {
default = "" default = ""
} }
variable "http_port_min" {
type = number
default = 8000
}
variable "http_port_max" {
type = number
default = 9000
}
variable "cpu_model" { variable "cpu_model" {
type = string type = string
default = "host" default = "host"
+3 -3
View File
@@ -28,16 +28,16 @@ source "qemu" "amd64" {
qemuargs = [ qemuargs = [
#["-chardev", "stdio,id=char0,logfile=serial-output-qemu-${var.arch}-${var.distro}-${var.version},signal=off"], #["-chardev", "stdio,id=char0,logfile=serial-output-qemu-${var.arch}-${var.distro}-${var.version},signal=off"],
#["-serial", "chardev:char0"], ["-chardev", "socket,path=${local.name}.qga.sock,server=on,wait=off,id=qga0"],
["-chardev", "socket,host=localhost,port=9876,server=on,wait=off,id=qga0"],
["-device", "virtio-serial"], ["-device", "virtio-serial"],
["-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"], ["-device", "virtserialport,chardev=qga0,name=org.qemu.guest_agent.0"],
["-qmp", "tcp:localhost:4444,server,wait=off"],
] ]
accelerator = var.qemu_accelerator accelerator = var.qemu_accelerator
http_content = var.http_files http_content = var.http_files
http_directory = var.http_directory http_directory = var.http_directory
http_port_min = var.http_port_min
http_port_max = var.http_port_max
cd_content = var.cd_content cd_content = var.cd_content
cd_files = var.cd_files cd_files = var.cd_files
cd_label = var.cd_label cd_label = var.cd_label