|
| 1 | +name: "nightly" |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' |
| 6 | + workflow_dispatch: |
| 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 | + steps: |
| 19 | + - name: Checkout Source |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Activate Ruby 2.7 |
| 23 | + uses: actions/setup-ruby@v1 |
| 24 | + with: |
| 25 | + ruby-version: "2.7" |
| 26 | + |
| 27 | + - name: Cache gems |
| 28 | + uses: actions/cache@v2 |
| 29 | + with: |
| 30 | + path: vendor/gems |
| 31 | + key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }} |
| 32 | + restore-keys: | |
| 33 | + ${{ runner.os }}-nightly- |
| 34 | + ${{ runner.os }}- |
| 35 | +
|
| 36 | + - name: Install gems |
| 37 | + run: | |
| 38 | + bundle config path vendor/gems |
| 39 | + bundle config jobs 8 |
| 40 | + bundle config retry 3 |
| 41 | + bundle install |
| 42 | + bundle clean |
| 43 | +
|
| 44 | + - name: Setup Acceptance Test Matrix |
| 45 | + id: get-matrix |
| 46 | + run: "bundle exec matrix_from_metadata" |
| 47 | + |
| 48 | + Acceptance: |
| 49 | + needs: |
| 50 | + - setup_matrix |
| 51 | + |
| 52 | + runs-on: ubuntu-20.04 |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout Source |
| 59 | + uses: actions/checkout@v2 |
| 60 | + |
| 61 | + - name: Activate Ruby 2.7 |
| 62 | + uses: actions/setup-ruby@v1 |
| 63 | + with: |
| 64 | + ruby-version: "2.7" |
| 65 | + |
| 66 | + - name: Cache gems |
| 67 | + uses: actions/cache@v2 |
| 68 | + with: |
| 69 | + path: vendor/gems |
| 70 | + key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }} |
| 71 | + restore-keys: | |
| 72 | + ${{ runner.os }}-nightly- |
| 73 | + ${{ runner.os }}- |
| 74 | +
|
| 75 | + - name: Install gems |
| 76 | + run: | |
| 77 | + bundle config path vendor/gems |
| 78 | + bundle config jobs 8 |
| 79 | + bundle config retry 3 |
| 80 | + bundle install |
| 81 | + bundle clean |
| 82 | +
|
| 83 | + - name: bundler environment |
| 84 | + run: | |
| 85 | + bundle env |
| 86 | +
|
| 87 | + - name: Provision test environment |
| 88 | + run: | |
| 89 | + bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]' |
| 90 | + echo ::group::=== REQUEST === |
| 91 | + cat request.json || true |
| 92 | + echo |
| 93 | + echo ::endgroup:: |
| 94 | + echo ::group::=== INVENTORY === |
| 95 | + sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true |
| 96 | + echo ::endgroup:: |
| 97 | +
|
| 98 | + # The provision service hands out machines as soon as they're provisioned. |
| 99 | + # The GCP VMs might still take a while to spool up and configure themselves fully. |
| 100 | + # This retry loop spins until all agents have been installed successfully. |
| 101 | + - name: Install agent |
| 102 | + uses: nick-invision/retry@v1 |
| 103 | + with: |
| 104 | + timeout_minutes: 30 |
| 105 | + max_attempts: 5 |
| 106 | + retry_wait_seconds: 90 |
| 107 | + command: bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' |
| 108 | + |
| 109 | + # The agent installer on windows does not finish in time for this to work. To |
| 110 | + # work around this for now, retry after a minute if installing the module failed. |
| 111 | + - name: Install module |
| 112 | + uses: nick-invision/retry@v1 |
| 113 | + with: |
| 114 | + timeout_minutes: 30 |
| 115 | + max_attempts: 5 |
| 116 | + retry_wait_seconds: 60 |
| 117 | + command: bundle exec rake 'litmus:install_module' |
| 118 | + |
| 119 | + - name: Run acceptance tests |
| 120 | + run: bundle exec rake 'litmus:acceptance:parallel' |
| 121 | + |
| 122 | + - name: Remove test environment |
| 123 | + if: ${{ always() }} |
| 124 | + run: | |
| 125 | + bundle exec rake 'litmus:tear_down' |
| 126 | + echo ::group::=== REQUEST === |
| 127 | + cat request.json || true |
| 128 | + echo |
| 129 | + echo ::endgroup:: |
| 130 | +
|
| 131 | + slack-workflow-status: |
| 132 | + if: always() |
| 133 | + name: Post Workflow Status To Slack |
| 134 | + needs: |
| 135 | + - Acceptance |
| 136 | + runs-on: ubuntu-20.04 |
| 137 | + steps: |
| 138 | + - name: Slack Workflow Notification |
| 139 | + uses: Gamesight/slack-workflow-status@master |
| 140 | + with: |
| 141 | + # Required Input |
| 142 | + repo_token: ${{secrets.GITHUB_TOKEN}} |
| 143 | + slack_webhook_url: ${{secrets.SLACK_WEBHOOK}} |
| 144 | + # Optional Input |
| 145 | + channel: '#team-ia-bots' |
| 146 | + name: 'GABot' |
0 commit comments