From d32eec2031063beede88119e5ecc7011b2d20c62 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 3 May 2022 20:02:24 -0500 Subject: [PATCH] Add basic syntax validation --- .github/actions/install_packer/action.yml | 21 +++++++++++++++++++++ .github/workflows/test.yml | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/actions/install_packer/action.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/actions/install_packer/action.yml b/.github/actions/install_packer/action.yml new file mode 100644 index 0000000..b7b1495 --- /dev/null +++ b/.github/actions/install_packer/action.yml @@ -0,0 +1,21 @@ +name: Install Packer +description: Installs the packerio executable and its attendant tools to ~/bin +inputs: + version: + description: Version of Packer to install + required: true + default: "1.8.0" +runs: + using: composite + steps: + - shell: bash + run: | + set -exo pipefail + sudo apt-get update + sudo apt-get install -y unzip python3-{virtualenv,yaml} cloud-utils qemu-system-{x86,ppc} + # Install packer.io + curl -O https://releases.hashicorp.com/packer/${{ inputs.version }}/packer_${{ inputs.version }}_linux_amd64.zip + unzip packer_${{ inputs.version }}_linux_amd64.zip + mkdir -p ~/bin/ + chmod +x packer + mv packer ~/bin/packerio diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b19c68e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Test the components of it + +on: + push: + pull-request: + +jobs: + validate: + runs-on: ubuntu-20.04 + tasks: + - name: Install packer + uses: .github/actions/install_packer/ + - name: Run syntax check + run: | + set -exo pipefail + for vars in distros/*; do + ~/bin/packerio validate -var-file=${vars} sources/ + done