Factor out setup
This commit is contained in:
@@ -16,6 +16,4 @@ runs:
|
|||||||
# Install packer.io
|
# Install packer.io
|
||||||
curl -O https://releases.hashicorp.com/packer/${{ inputs.version }}/packer_${{ inputs.version }}_linux_amd64.zip
|
curl -O https://releases.hashicorp.com/packer/${{ inputs.version }}/packer_${{ inputs.version }}_linux_amd64.zip
|
||||||
unzip packer_${{ inputs.version }}_linux_amd64.zip
|
unzip packer_${{ inputs.version }}_linux_amd64.zip
|
||||||
mkdir -p ~/bin/
|
|
||||||
chmod +x packer
|
chmod +x packer
|
||||||
mv packer ~/bin/packerio
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
name: Setup environment
|
||||||
|
description: Sets up some basic components of the environment
|
||||||
|
inputs:
|
||||||
|
ansible:
|
||||||
|
description: Install Ansible as well
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Checkout project
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Install Python 3
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3"
|
||||||
|
- name: Setup pip cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cache/pip
|
||||||
|
key: python-pip
|
||||||
|
- name: Install Pip and tox
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -exo pipefail
|
||||||
|
python3 -m pip install -U pip
|
||||||
|
pip install -U wheel
|
||||||
|
pip install -U tox
|
||||||
|
- name: Install Ansible
|
||||||
|
if: inputs.ansible
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -exo pipefail
|
||||||
|
pip install -U ansible
|
||||||
|
ansible-galaxy collection install -r ansible/requirements.yml
|
||||||
@@ -27,35 +27,14 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
distro: ${{ fromJson( needs.collect.outputs.distros ) }}
|
distro: ${{ fromJson( needs.collect.outputs.distros ) }}
|
||||||
packer_version:
|
|
||||||
- "1.8.0"
|
|
||||||
needs_timeout:
|
needs_timeout:
|
||||||
- distros/ubuntu-20.04-x86_64.pkrvars.hcl
|
- distros/ubuntu-20.04-x86_64.pkrvars.hcl
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
ansible: true
|
||||||
|
- uses: ./.github/actions/install_packer
|
||||||
- uses: greg-hellings/make-space@main
|
- uses: greg-hellings/make-space@main
|
||||||
- uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: "3"
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.cache/pip
|
|
||||||
key: python-pip
|
|
||||||
- name: install dependencies
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y unzip cloud-utils qemu-system-{x86,ppc}
|
|
||||||
python3 -m pip install -U wheel
|
|
||||||
python3 -m pip install -U ansible
|
|
||||||
# Install packer.io
|
|
||||||
curl -O https://releases.hashicorp.com/packer/${{ matrix.packer_version }}/packer_${{ matrix.packer_version }}_linux_amd64.zip
|
|
||||||
unzip packer_${{ matrix.packer_version }}_linux_amd64.zip
|
|
||||||
mv packer packerio
|
|
||||||
chmod +x packerio
|
|
||||||
- name: modify build timeouts, if necessary
|
- name: modify build timeouts, if necessary
|
||||||
if: contains(matrix.needs_timeout, matrix.distro)
|
if: contains(matrix.needs_timeout, matrix.distro)
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -64,6 +43,8 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
# Add a retry in case something bogus like a network failure happens
|
||||||
|
./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources || \
|
||||||
./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources
|
./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources
|
||||||
env:
|
env:
|
||||||
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
|
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
|
||||||
|
|||||||
@@ -18,17 +18,13 @@ jobs:
|
|||||||
name: Validate Packer templates are reasonable
|
name: Validate Packer templates are reasonable
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: ./.github/actions/setup
|
||||||
uses: actions/checkout@v3
|
- uses: ./.github/actions/install_packer
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Install packer
|
|
||||||
uses: ./.github/actions/install_packer/
|
|
||||||
- name: Run syntax check
|
- name: Run syntax check
|
||||||
run: |
|
run: |
|
||||||
set -exo pipefail
|
set -exo pipefail
|
||||||
for vars in distros/*; do
|
for vars in distros/*; do
|
||||||
~/bin/packerio validate -except=upload -var-file=${vars} sources/
|
packer validate -except=upload -var-file=${vars} sources/
|
||||||
done
|
done
|
||||||
|
|
||||||
collect:
|
collect:
|
||||||
@@ -37,19 +33,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
all: ${{ steps.zipped.outputs.scenarios }}
|
all: ${{ steps.zipped.outputs.scenarios }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.cache/pip
|
|
||||||
key: python-pip
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
set -ex
|
|
||||||
python -m pip install --upgrade tox
|
|
||||||
- name: Collect dependencies
|
- name: Collect dependencies
|
||||||
id: collection
|
id: collection
|
||||||
uses: greg-hellings/tox-list@v1
|
uses: greg-hellings/tox-list@v1
|
||||||
@@ -74,20 +58,9 @@ jobs:
|
|||||||
name: Lint Ansible code
|
name: Lint Ansible code
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: ./.github/actions/setup
|
||||||
with:
|
with:
|
||||||
submodules: true
|
ansible: true
|
||||||
- name: Install Python
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.cache/pip
|
|
||||||
key: python-pip
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |-
|
|
||||||
set -ex
|
|
||||||
python -m pip install --upgrade tox ansible
|
|
||||||
ansible-galaxy collection install -r ansible/requirements.yml
|
|
||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: tox -e lint_all
|
run: tox -e lint_all
|
||||||
|
|
||||||
@@ -101,16 +74,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
scenarios: "${{ fromJson(needs.collect.outputs.all) }}"
|
scenarios: "${{ fromJson(needs.collect.outputs.all) }}"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: ./.github/actions/setup
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Install Python
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: ~/.cache/pip
|
|
||||||
key: python-pip
|
|
||||||
- name: Install dependencies
|
|
||||||
run: python -m pip install --upgrade tox
|
|
||||||
- name: Run scenario
|
- name: Run scenario
|
||||||
run: tox -e "${{ matrix.scenarios.scenario }}"
|
run: tox -e "${{ matrix.scenarios.scenario }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user