Factor out setup
This commit is contained in:
@@ -27,35 +27,14 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distro: ${{ fromJson( needs.collect.outputs.distros ) }}
|
||||
packer_version:
|
||||
- "1.8.0"
|
||||
needs_timeout:
|
||||
- distros/ubuntu-20.04-x86_64.pkrvars.hcl
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
ansible: true
|
||||
- uses: ./.github/actions/install_packer
|
||||
- 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
|
||||
if: contains(matrix.needs_timeout, matrix.distro)
|
||||
shell: bash
|
||||
@@ -64,6 +43,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
env:
|
||||
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
|
||||
|
||||
@@ -18,17 +18,13 @@ jobs:
|
||||
name: Validate Packer templates are reasonable
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install packer
|
||||
uses: ./.github/actions/install_packer/
|
||||
- uses: ./.github/actions/setup
|
||||
- uses: ./.github/actions/install_packer
|
||||
- name: Run syntax check
|
||||
run: |
|
||||
set -exo pipefail
|
||||
for vars in distros/*; do
|
||||
~/bin/packerio validate -except=upload -var-file=${vars} sources/
|
||||
packer validate -except=upload -var-file=${vars} sources/
|
||||
done
|
||||
|
||||
collect:
|
||||
@@ -37,19 +33,7 @@ jobs:
|
||||
outputs:
|
||||
all: ${{ steps.zipped.outputs.scenarios }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
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
|
||||
- uses: ./.github/actions/setup
|
||||
- name: Collect dependencies
|
||||
id: collection
|
||||
uses: greg-hellings/tox-list@v1
|
||||
@@ -74,20 +58,9 @@ jobs:
|
||||
name: Lint Ansible code
|
||||
runs-on: ubuntu-latest
|
||||
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: |-
|
||||
set -ex
|
||||
python -m pip install --upgrade tox ansible
|
||||
ansible-galaxy collection install -r ansible/requirements.yml
|
||||
ansible: true
|
||||
- name: Run lint
|
||||
run: tox -e lint_all
|
||||
|
||||
@@ -101,16 +74,6 @@ jobs:
|
||||
matrix:
|
||||
scenarios: "${{ fromJson(needs.collect.outputs.all) }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
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
|
||||
- uses: ./.github/actions/setup
|
||||
- name: Run scenario
|
||||
run: tox -e "${{ matrix.scenarios.scenario }}"
|
||||
|
||||
Reference in New Issue
Block a user