Run acceptance tests directly on GitHub runners #117
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: PR checks | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- $default-branch | |
pull_request: | |
jobs: | |
validate: | |
name: Validate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install PDK | |
run: | | |
set -ex | |
distro=$(lsb_release -cs) | |
curl -sSO "https://apt.puppet.com/puppet-tools-release-${distro}.deb" | |
sudo dpkg -i "puppet-tools-release-${distro}.deb" | |
rm "puppet-tools-release-${distro}.deb" | |
sudo apt-get update -qq | |
sudo apt-get install -qy pdk | |
- run: pdk validate | |
- name: Confirm REFERENCE.md is up-to-date | |
run: | | |
pdk bundle exec puppet strings generate --format markdown | |
git add . | |
git diff --staged --color --exit-code | |
- name: Confirm PDK update does nothing | |
run: | | |
pdk update --force | |
git add . | |
git diff --staged --color --exit-code | |
test-unit: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "2.7" | |
bundler-cache: true | |
- name: Enable rspec color output | |
run: echo '--force-color' >> ~/.rspec | |
- run: bundle exec rake spec | |
test-acceptance: | |
name: Acceptance tests | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
agent: ['puppet7', 'puppet8'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Puppet | |
run: | | |
set -ex | |
distro=$(lsb_release -cs) | |
deb_name="${{ matrix.agent }}-release-${distro}.deb" | |
curl -sSO "https://apt.puppet.com/${deb_name}" | |
sudo dpkg -i "$deb_name" | |
rm "$deb_name" | |
sudo apt-get update -qq | |
sudo apt-get install -qy puppet-agent pdk | |
- name: Build module | |
run: pdk build | |
- name: Install module | |
run: sudo /opt/puppetlabs/bin/puppet module install pkg/*.tar.gz | |
- name: Install PDK dependencies | |
run: sudo pdk bundle install | |
- name: Enable rspec color output | |
run: echo '--force-color' >> ~/.rspec | |
- name: Run acceptance tests | |
run: sudo pdk bundle exec rake litmus:acceptance:localhost |