|
| 1 | +name: "nightly" |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' |
| 6 | + |
| 7 | + |
| 8 | +env: |
| 9 | + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 |
| 10 | + HONEYCOMB_DATASET: litmus tests |
| 11 | + |
| 12 | +jobs: |
| 13 | + setup_matrix: |
| 14 | + name: "Setup Test Matrix" |
| 15 | + runs-on: ubuntu-20.04 |
| 16 | + outputs: |
| 17 | + matrix: ${{ steps.get-matrix.outputs.matrix }} |
| 18 | + |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: "Honeycomb: Start recording" |
| 22 | + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 |
| 23 | + with: |
| 24 | + apikey: ${{ env.HONEYCOMB_WRITEKEY }} |
| 25 | + dataset: ${{ env.HONEYCOMB_DATASET }} |
| 26 | + job-status: ${{ job.status }} |
| 27 | + |
| 28 | + - name: "Honeycomb: Start first step" |
| 29 | + run: | |
| 30 | + echo STEP_ID=setup-environment >> $GITHUB_ENV |
| 31 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 32 | + - name: Checkout Source |
| 33 | + uses: actions/checkout@v2 |
| 34 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 35 | + |
| 36 | + - name: Activate Ruby 2.7 |
| 37 | + uses: ruby/setup-ruby@v1 |
| 38 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 39 | + with: |
| 40 | + ruby-version: "2.7" |
| 41 | + bundler-cache: true |
| 42 | + |
| 43 | + - name: Print bundle environment |
| 44 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 45 | + run: | |
| 46 | + echo ::group::bundler environment |
| 47 | + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env |
| 48 | + echo ::endgroup:: |
| 49 | + |
| 50 | + - name: "Honeycomb: Record Setup Environment time" |
| 51 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 52 | + run: | |
| 53 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' |
| 54 | + echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV |
| 55 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 56 | + - name: Setup Acceptance Test Matrix |
| 57 | + id: get-matrix |
| 58 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 59 | + run: | |
| 60 | + if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then |
| 61 | + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 --exclude-platforms '["RedHat-6", "RedHat-7", "RedHat-8", "CentOS-6", "CentOS-7", "CentOS-8", "OracleLinux-6", "OracleLinux-7", "Rocky-8"]' |
| 62 | + else |
| 63 | + echo "::set-output name=matrix::{}" |
| 64 | + fi |
| 65 | + |
| 66 | + - name: "Honeycomb: Record Setup Test Matrix time" |
| 67 | + if: ${{ always() }} |
| 68 | + run: | |
| 69 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' |
| 70 | + Acceptance: |
| 71 | + name: "${{matrix.platforms.label}}, ${{matrix.collection}}" |
| 72 | + needs: |
| 73 | + - setup_matrix |
| 74 | + |
| 75 | + runs-on: ubuntu-20.04 |
| 76 | + strategy: |
| 77 | + fail-fast: false |
| 78 | + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} |
| 79 | + |
| 80 | + env: |
| 81 | + BUILDEVENT_FILE: '../buildevents.txt' |
| 82 | + |
| 83 | + steps: |
| 84 | + - run: | |
| 85 | + echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE |
| 86 | + echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE |
| 87 | + echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE |
| 88 | +
|
| 89 | +
|
| 90 | + - name: "Honeycomb: Start recording" |
| 91 | + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 |
| 92 | + with: |
| 93 | + apikey: ${{ env.HONEYCOMB_WRITEKEY }} |
| 94 | + dataset: ${{ env.HONEYCOMB_DATASET }} |
| 95 | + job-status: ${{ job.status }} |
| 96 | + matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }} |
| 97 | + |
| 98 | + - name: "Honeycomb: start first step" |
| 99 | + run: | |
| 100 | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV |
| 101 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 102 | +
|
| 103 | + - name: Checkout Source |
| 104 | + uses: actions/checkout@v2 |
| 105 | + |
| 106 | + - name: Activate Ruby 2.7 |
| 107 | + uses: ruby/setup-ruby@v1 |
| 108 | + with: |
| 109 | + ruby-version: "2.7" |
| 110 | + bundler-cache: true |
| 111 | + |
| 112 | + - name: Print bundle environment |
| 113 | + run: | |
| 114 | + echo ::group::bundler environment |
| 115 | + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env |
| 116 | + echo ::endgroup:: |
| 117 | +
|
| 118 | + - name: "Honeycomb: Record Setup Environment time" |
| 119 | + if: ${{ always() }} |
| 120 | + run: | |
| 121 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' |
| 122 | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV |
| 123 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 124 | +
|
| 125 | + - name: Provision test environment |
| 126 | + run: | |
| 127 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' |
| 128 | + echo ::group::=== REQUEST === |
| 129 | + cat request.json || true |
| 130 | + echo |
| 131 | + echo ::endgroup:: |
| 132 | + echo ::group::=== INVENTORY === |
| 133 | + if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; |
| 134 | + then |
| 135 | + FILE='spec/fixtures/litmus_inventory.yaml' |
| 136 | + elif [ -f 'inventory.yaml' ]; |
| 137 | + then |
| 138 | + FILE='inventory.yaml' |
| 139 | + fi |
| 140 | + sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true |
| 141 | + echo ::endgroup:: |
| 142 | +
|
| 143 | + - name: Install agent |
| 144 | + run: | |
| 145 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' |
| 146 | +
|
| 147 | + - name: Install module |
| 148 | + run: | |
| 149 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' |
| 150 | +
|
| 151 | + - name: "Honeycomb: Record deployment times" |
| 152 | + if: ${{ always() }} |
| 153 | + run: | |
| 154 | + echo ::group::honeycomb step |
| 155 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system' |
| 156 | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV |
| 157 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 158 | + echo ::endgroup:: |
| 159 | +
|
| 160 | + - name: Run acceptance tests |
| 161 | + run: | |
| 162 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel' |
| 163 | +
|
| 164 | + - name: "Honeycomb: Record acceptance testing times" |
| 165 | + if: ${{ always() }} |
| 166 | + run: | |
| 167 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests' |
| 168 | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV |
| 169 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 170 | +
|
| 171 | + - name: Remove test environment |
| 172 | + if: ${{ always() }} |
| 173 | + continue-on-error: true |
| 174 | + run: | |
| 175 | + if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then |
| 176 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' |
| 177 | + echo ::group::=== REQUEST === |
| 178 | + cat request.json || true |
| 179 | + echo |
| 180 | + echo ::endgroup:: |
| 181 | + fi |
| 182 | +
|
| 183 | + - name: "Honeycomb: Record removal times" |
| 184 | + if: ${{ always() }} |
| 185 | + run: | |
| 186 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' |
| 187 | +
|
| 188 | + slack-workflow-status: |
| 189 | + if: always() |
| 190 | + name: Post Workflow Status To Slack |
| 191 | + needs: |
| 192 | + - Acceptance |
| 193 | + runs-on: ubuntu-20.04 |
| 194 | + steps: |
| 195 | + - name: Slack Workflow Notification |
| 196 | + uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1 |
| 197 | + with: |
| 198 | + # Required Input |
| 199 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 200 | + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} |
| 201 | + # Optional Input |
| 202 | + channel: '#team-ia-bots' |
| 203 | + name: 'GABot' |
0 commit comments