Skip to content
---
on:
workflow_call:
env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
jobs:
x86_64:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os:
# - almalinux-8
- almalinux-9
# - centos-7
# - centos-stream-8
# - centos-stream-9
# - debian-11
# - debian-12
# - fedora-38
# - fedora-39
# - freebsd-13
# - freebsd-14
# - opensuse-leap-15
# - oracle-7
# - oracle-8
# - oracle-9
# - rockylinux-8
# - rockylinux-9
# - ubuntu-20.04
# - ubuntu-22.04
# - ubuntu-23.10
provider:
- hyperv-iso
steps:
- name: Checkout
uses: actions/checkout@main
- name: iso-availability
shell: pwsh
run: Invoke-RestMethod -Method Head -Verbose -Uri $(Get-Content os_pkrvars/$('${{ matrix.os }}'.split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl | ConvertFrom-StringData).iso_url.Trim('"')

Check failure on line 42 in .github/workflows/test-pkr-bld-hyperv-x64.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/test-pkr-bld-hyperv-x64.yml

Invalid workflow file

You have an error in your yaml syntax on line 42
- name: tests
shell: pwsh
run: |
packer -v
# DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
$hyperv = Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online
# Check if Hyper-V is enabled
if($hyperv.State -eq "Enabled") {
Write-Host "Hyper-V is enabled."
} else {
Write-Host "Hyper-V is disabled."
}
Get-WindowsFeature
# - name: Packer Init
# run: packer init -upgrade packer_templates
# - name: Packer FMT
# run: packer fmt -check -recursive .
# - name: Packer Validate
# run: packer validate -var-file="os_pkrvars/$("${{ matrix.os }}".Split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates
# - name: Packer build
# run: packer build -timestamp-ui -only="${{ matrix.provider }}.vm" -var-file="os_pkrvars/$("${{ matrix.os }}".Split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates
# - name: Remove VM in case of canceled job
# if: cancelled()
# run: |
# echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64
# Stop-VM -Force ${{ matrix.os }}*-amd64
# sleep 1
# Remove-VM -Force ${{ matrix.os }}*-amd64
# sleep 2
# - name: Upload build artifact
# uses: actions/upload-artifact@main
# with:
# name: "${{ matrix.os }}-hyperv-x86_64"
# path: |
# builds/*.box
# retention-days: 10