Fix required plugins (#29) #35
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: ci | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
unit-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
puppet_version: [6,7] | |
name: Check / Puppet ${{ matrix.puppet_version }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Run pdk validate | |
uses: puppets-epic-show-theatre/[email protected] | |
with: | |
puppet-version: ${{ matrix.puppet_version }} | |
- name: Run pdk test unit | |
uses: puppets-epic-show-theatre/action-pdk-test-unit@193987acba9977d1825fefbcbaf8d02d6af78106 | |
with: | |
puppet-version: ${{ matrix.puppet_version }} | |
coverage: | |
strategy: | |
fail-fast: false | |
matrix: | |
puppet_version: [7] | |
name: Coverage | |
runs-on: ubuntu-20.04 | |
needs: | |
- unit-tests | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.7" | |
bundler-cache: true | |
- name: Run test coverage | |
run: | | |
bundle exec rake spec:simplecov | |
acceptance: | |
name: "OPNsense 23.1, Rocky-8, puppet7" | |
runs-on: macOS-12 | |
needs: | |
- unit-tests | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Install docker | |
run: | | |
mkdir -p ~/.docker/machine/cache | |
curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso | |
brew install docker docker-machine | |
docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.56.1/24" --virtualbox-boot2docker-url ~/.docker/machine/cache/boot2docker.iso default | |
docker-machine env default | |
- name: Checkout Source | |
uses: actions/checkout@v2 | |
- name: Activate ruby and install libaries | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.7" | |
bundler-cache: true | |
- name: Cache Vagrant boxes | |
uses: actions/cache@v2 | |
with: | |
path: ~/.vagrant.d/boxes | |
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} | |
restore-keys: | | |
${{ runner.os }}-vagrant- | |
- name: Show Vagrant version | |
run: vagrant --version | |
- name: Run vagrant up | |
run: vagrant up | |
- name: show ip config for host | |
run: | | |
ifconfig | |
- name: Get NAT IP for vagrant box | |
run: | | |
echo "MY_IP=$( ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2|head -n1)" >> $GITHUB_ENV | |
- name: Deploy opn-cli config | |
run: | | |
cp spec/fixtures/acceptance/opn-cli/conf.yaml.dist spec/fixtures/acceptance/opn-cli/conf.yaml | |
sed -i '' "s/host.docker.internal/${{ env.MY_IP }}/g" spec/fixtures/acceptance/opn-cli/conf.yaml | |
cp spec/fixtures/acceptance/opn-cli/ca.pem.dist spec/fixtures/acceptance/opn-cli/ca.pem | |
echo ::group::=== OPN-CLI CONFIG === | |
cat spec/fixtures/acceptance/opn-cli/conf.yaml | |
echo ::group::=== OPN-CLI CERT === | |
cat spec/fixtures/acceptance/opn-cli/ca.pem | |
- name: Provision litmus docker container | |
run: | | |
eval $(docker-machine env default) | |
bundle exec rake 'litmus:provision_list[acceptance]' | |
sed -i '' ' | |
/shell-command: bash -lc/a\ | |
\ \ \ \ \ \ \ \ tmpdir: "\/\" | |
' spec/fixtures/litmus_inventory.yaml | |
echo ::group::=== INVENTORY === | |
if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; | |
then | |
FILE='spec/fixtures/litmus_inventory.yaml' | |
elif [ -f 'inventory.yaml' ]; | |
then | |
FILE='inventory.yaml' | |
fi | |
cat $FILE | |
#sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true | |
echo ::endgroup:: | |
- name: Install puppet agent 7 | |
run: | | |
eval $(docker-machine env default) | |
bundle exec rake 'litmus:install_agent[puppet7]' | |
- name: Install puppet module | |
run: | | |
eval $(docker-machine env default) | |
bundle exec rake 'litmus:install_module' | |
- name: Run acceptance tests | |
run: | | |
eval $(docker-machine env default) | |
bundle exec rake 'litmus:acceptance:parallel' | |
- name: Remove test environment | |
if: ${{ always() }} | |
continue-on-error: true | |
run: | | |
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then | |
eval $(docker-machine env default) | |
bundle exec rake 'litmus:tear_down' | |
fi | |
vagrant destroy -f |