fixup! Add test for newly built image #138
Workflow file for this run
This file contains hidden or 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: Build VM Disk Image | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: ${{ matrix.version }} ${{ matrix.architecture.name }} | |
runs-on: ubuntu-latest | |
container: alpine:edge | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
# - '12.2' | |
# - '13.0' | |
# - '13.1' | |
# - '13.2' | |
# - '13.3' | |
# - '13.4' | |
# - '13.5' | |
# - '14.0' | |
# - '14.1' | |
- '14.2' | |
architecture: | |
- name: x86-64 | |
qemu: x86 | |
uname: amd64 | |
# - name: arm64 | |
# qemu: aarch64 | |
exclude: | |
- version: '12.2' | |
architecture: | |
name: arm64 | |
qemu: aarch64 | |
# include: | |
# - version: '12.4' | |
# copy_from_previous_release: true | |
# architecture: | |
# name: arm64 | |
# qemu: aarch64 | |
# | |
# - version: '12.4' | |
# architecture: | |
# name: x86-64 | |
# qemu: x86_64 | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
# - name: Install Dependencies | |
# run: sudo apt update && sudo apt install -y fdisk dosfstools rsync "qemu-system-${{ matrix.architecture.qemu }}" | |
# - name: Install Dependencies | |
# run: | | |
# apk add --no-cache \ | |
# curl \ | |
# python3 \ | |
# qemu-img \ | |
# "qemu-system-${{ matrix.architecture.qemu }}" | |
# | |
# - uses: hashicorp/setup-packer@main | |
# with: | |
# version: "1.9.1" | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
- name: Build Image | |
if: '!matrix.copy_from_previous_release' | |
env: | |
PACKER_LOG: 1 | |
run: | | |
./build.sh '${{ matrix.version }}' '${{ matrix.architecture.name }}' \ | |
-var 'headless=true' | |
- name: Copy from previous release | |
if: matrix.copy_from_previous_release | |
run: | | |
curl -O -L \ | |
--retry 3 \ | |
--create-dirs \ | |
--output-dir output \ | |
https://github.com/cross-platform-actions/freebsd-builder/releases/download/v0.5.0/freebsd-${{ matrix.version }}-${{ matrix.architecture.name }}.qcow2 | |
- name: Start Local HTTP Server | |
run: python3 -m http.server 8080 --directory output & | |
- name: Create File | |
run: echo 'host to guest' > host_to_guest.txt | |
- name: Test Image | |
uses: cross-platform-actions/action@master | |
with: | |
operating_system: freebsd | |
architecture: ${{ matrix.architecture.name }} | |
version: '${{ matrix.version }}' | |
image_url: http://localhost:8080/freebsd-${{ matrix.version }}-${{ matrix.architecture.name }}.qcow2 | |
shutdown_vm: false | |
shell: bash | |
run: | | |
echo "uname -a = $(uname -a)" | |
echo "uname -s = $(uname -s)" | |
echo "uname -r = $(uname -r)" | |
echo "uname -v = $(uname -v)" | |
echo "uname -m = $(uname -m)" | |
echo "uname -p = $(uname -p)" | |
pwd | |
echo $SHELL | |
ls -lah | |
whoami | |
env | sort | |
[ "`uname -s`" = 'FreeBSD' ] | |
[ "`uname -r`" = '${{ matrix.version}}-RELEASE' ] | |
[ "`uname -m`" = '${{ matrix.architecture.uname || matrix.architecture.name }}' ] | |
[ "`pwd`" = '/home/runner/work/freebsd-builder/freebsd-builder' ] || [ "`pwd`" = '/usr/home/runner/work/freebsd-builder/freebsd-builder' ] | |
cat host_to_guest.txt | grep -q 'host to guest' | |
echo 'guest to host' > guest_to_host.txt | |
- name: Verify File Synchronization | |
run: cat guest_to_host.txt | grep -q 'guest to host' | |
- name: Extract Version | |
id: version | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: FreeBSD ${{ steps.version.outputs.VERSION }} | |
draft: true | |
files: output/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |