|
| 1 | +name: "PE Nightly Acceptance Testing" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + workflow_call: |
| 6 | + |
| 7 | +jobs: |
| 8 | + setup_matrix: |
| 9 | + name: "Setup Test Matrix" |
| 10 | + runs-on: ubuntu-20.04 |
| 11 | + outputs: |
| 12 | + matrix: ${{ steps.get-matrix.outputs.matrix }} |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout Source |
| 16 | + uses: actions/checkout@v2 |
| 17 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 18 | + |
| 19 | + - name: Activate Ruby 2.7 |
| 20 | + uses: ruby/setup-ruby@v1 |
| 21 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 22 | + with: |
| 23 | + ruby-version: "2.7" |
| 24 | + bundler-cache: true |
| 25 | + |
| 26 | + - name: Print bundle environment |
| 27 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 28 | + run: | |
| 29 | + echo ::group::bundler environment |
| 30 | + bundle env |
| 31 | + echo ::endgroup:: |
| 32 | +
|
| 33 | + - name: 'Activate twingate to obtain unreleased build' |
| 34 | + uses: twingate/github-action@v1 |
| 35 | + with: |
| 36 | + service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }} |
| 37 | + |
| 38 | + - name: 'Get latest build name' |
| 39 | + id: latest |
| 40 | + run: | |
| 41 | + echo "::set-output name=ver::$(curl -q https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/main/ci-ready/LATEST)" |
| 42 | +
|
| 43 | + - name: Setup Acceptance Test Matrix |
| 44 | + id: get-matrix |
| 45 | + run: | |
| 46 | + if [[ -e spec/fixtures/matrix/nightly.json ]]; then |
| 47 | + out=$(jq -c '. + ($matrix | .[])' --slurpfile matrix spec/fixtures/matrix/nightly.json <<<'${{ steps.latest_release.outputs.latest }}') |
| 48 | + echo "::set-output name=matrix::$out" |
| 49 | + else |
| 50 | + echo "::set-output name=matris::{}" |
| 51 | + fi |
| 52 | +
|
| 53 | + Acceptance: |
| 54 | + name: "${{matrix.platforms.label}}, ${{matrix.collection}}" |
| 55 | + needs: |
| 56 | + - setup_matrix |
| 57 | + if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} |
| 58 | + |
| 59 | + runs-on: ubuntu-20.04 |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout Source |
| 66 | + uses: actions/checkout@v2 |
| 67 | + |
| 68 | + - name: Activate Ruby 2.7 |
| 69 | + uses: ruby/setup-ruby@v1 |
| 70 | + with: |
| 71 | + ruby-version: "2.7" |
| 72 | + bundler-cache: true |
| 73 | + - name: Print bundle environment |
| 74 | + run: | |
| 75 | + echo ::group::bundler environment |
| 76 | + bundle env |
| 77 | + echo ::endgroup:: |
| 78 | +
|
| 79 | + - name: Provision test environment |
| 80 | + run: | |
| 81 | + bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' |
| 82 | + echo ::group::=== REQUEST === |
| 83 | + cat request.json || true |
| 84 | + echo |
| 85 | + echo ::endgroup:: |
| 86 | + echo ::group::=== INVENTORY === |
| 87 | + if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; |
| 88 | + then |
| 89 | + FILE='spec/fixtures/litmus_inventory.yaml' |
| 90 | + elif [ -f 'inventory.yaml' ]; |
| 91 | + then |
| 92 | + FILE='inventory.yaml' |
| 93 | + fi |
| 94 | + sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true |
| 95 | + echo ::endgroup:: |
| 96 | + echo INVENTORY_PATH=$FILE >> $GITHUB_ENV |
| 97 | +
|
| 98 | + - name: 'Activate twingate' |
| 99 | + uses: twingate/github-action@v1 |
| 100 | + with: |
| 101 | + service-key: ${{ secrets.TWINGATE_PUBLIC_REPO_KEY }} |
| 102 | + |
| 103 | + - name: Install PE |
| 104 | + run: | |
| 105 | + bundle exec bolt --tmpdir /tmp --log-level debug --modulepath spec/fixtures/modules -i ./$INVENTORY_PATH plan run deploy_pe::provision_master --params '{"download_url":"https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/main/ci-ready/puppet-enterprise-${{ steps.latest.outputs.ver }}-${{matrix.platforms.os-family}}.tar","pe_settings":{"password":"puppetlabs", "configure_tuning": false}}' --targets all --stream |
| 106 | +
|
| 107 | + - name: Install module |
| 108 | + run: | |
| 109 | + bundle exec rake 'litmus:install_module' |
| 110 | + - name: Run acceptance tests |
| 111 | + run: | |
| 112 | + bundle exec rake 'litmus:acceptance:parallel' |
| 113 | + - name: Remove test environment |
| 114 | + if: ${{ always() }} |
| 115 | + continue-on-error: true |
| 116 | + run: | |
| 117 | + if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then |
| 118 | + bundle exec rake 'litmus:tear_down' |
| 119 | + echo ::group::=== REQUEST === |
| 120 | + cat request.json || true |
| 121 | + echo |
| 122 | + echo ::endgroup:: |
| 123 | + fi |
0 commit comments