Files
vms/.github/workflows/test.yml
T
Greg HellingsandGitHub 634aae8d75 Do some better linting (#13)
* Do some better linting

* Update names, Packer version, and more

* Do not lint on push

* More linting and scripting

* Cleanup shellcheck lint

* Add Packer format check

* Fix Packer formatting

* Limit to only one

* Remove generated HCL files

* Only lint checked files

* Use pipes instead

* Improve attempt to build

Actually go back to attempting to build boxes on GitHub. Maybe it will
work better with this structure

* Change to using environment files

* Initialize plugins, first

* More verbose usage of the file

* Do the output properly this time

* PACKER_LOG set to 1

* No need for python3 anymore

* Limit to only one result

* Choose a specific CPU model

* Init separately

* Update actions version

* Add version outputting

* Correct actions version

* Try to execute qemu properly

* Fix CPU model name

* Do not over-subscribe GitHub runners

* Try type instead of command to guard runs

* Do not write to non-existent folder

* Cache packer plugins

* Use ~ instead of /home/greg

* Try the proper path

* Move to intelligent matrix

* Set global env path

* Add lots of waits for VBoxManage on hosted runners

* Add more waits

* Add more waits
2023-12-06 10:21:32 -06:00

61 lines
1.5 KiB
YAML

name: Lint and validation
"on":
pull_request:
workflow_dispatch:
jobs:
validate:
name: Validate Packer templates are reasonable
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Packer
uses: ./.github/actions/install_packer
- name: Restore Packer plugin cache
uses: actions/cache/restore@v3
id: cache-restore
with:
path: ~/.config/packer/plugins
key: ${{ runner.os }}-${{ hashFiles('sources/build.pkr.hcl') }}
- name: Install Packer plugins
shell: bash
run: packer init sources
- name: Cache Packer plugins
uses: actions/cache/save@v3
if: always()
with:
path: ~/.config/packer/plugins
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Run validate check
run: |
set -exo pipefail
for vars in $(find distros/ -name '*.pkrvars.hcl*'); do
if [[ "${vars}" == *.sh ]]; then
"./${vars}"
vars=${vars%.sh}
fi
packer validate -except=upload -var-file=${vars} sources/
done
- name: Run Packer format check
run: git ls-files | grep -E -e '.hcl$' | xargs -L 1 packer fmt -check
lint:
name: Lint shell code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install shellcheck
run: |
shellcheck --version
shellcheck $(find . -name '*.sh')