add Project support #105
Workflow file for this run
This file contains 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: E2E tests | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
logs: | |
description: "Set 1 to activate full logs" | |
required: false | |
default: "0" | |
jobs: | |
plugin-build: | |
runs-on: [self-hosted, nxlab, packer] | |
outputs: | |
test-list: ${{ steps.test-list.outputs.list}} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup `golang` | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ">=1.19.0" | |
- name: Build packer plugin | |
run: | | |
cd $GITHUB_WORKSPACE | |
make dev | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: packer-plugin-nutanix | |
path: ~/.config/packer/plugins/packer-plugin-nutanix | |
retention-days: 7 | |
- name: build test list | |
id: test-list | |
run: echo "list=$(ls test/e2e | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
e2e: | |
name: E2E test | |
needs: plugin-build | |
strategy: | |
matrix: | |
test: ${{fromJSON(needs.plugin-build.outputs.test-list)}} | |
runs-on: [self-hosted, nxlab, packer] | |
defaults: | |
run: | |
working-directory: test/e2e/${{ matrix.test}} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup `packer` | |
uses: hashicorp/setup-packer@main | |
id: setup-packer | |
- name: Setup `xorriso` | |
run: | | |
sudo apt update -y | |
sudo apt install -y xorriso | |
- uses: actions/download-artifact@v3 | |
with: | |
name: packer-plugin-nutanix | |
path: /tmp | |
- name: Install plugin | |
run: | | |
mkdir -p ~/.config/packer/plugins/ | |
cp /tmp/packer-plugin-nutanix ~/.config/packer/plugins/packer-plugin-nutanix | |
chmod 755 ~/.config/packer/plugins/packer-plugin-nutanix | |
- name: Run `packer init` | |
id: init | |
run: | | |
packer init . | |
- name: Run `packer validate` | |
id: validate | |
run: packer validate -var "test=${{ matrix.test}}" . | |
env: | |
PACKER_LOG: ${{ github.event.inputs.logs }} | |
- name: Run `packer build` | |
id: build | |
run: packer build -var "test=${{ matrix.test}}" . | |
env: | |
PACKER_LOG: ${{ github.event.inputs.logs }} | |
results: | |
if: ${{ always() }} | |
runs-on: [self-hosted, nxlab, packer] | |
name: Final E2E results | |
needs: [e2e] | |
steps: | |
- run: | | |
result="${{ needs.e2e.result }}" | |
if [[ $result == "success" || $result == "skipped" ]]; then | |
exit 0 | |
else | |
exit 1 | |
fi |