-
Notifications
You must be signed in to change notification settings - Fork 4.4k
136 lines (133 loc) · 5.63 KB
/
spectesting.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
on:
# Allows manual trigger on arbitrary branches via GitHub UI/API
workflow_dispatch:
repository_dispatch:
types: [prerelease]
schedule:
# Run nightly on weekdays at 05:00 UTC or midnight-ish in US time zones
- cron: '0 5 * * 1-5'
jobs:
setup-packet:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.nano']
name: Build Packet Instance
steps:
- name: Authentication
id: vault-auth
run: vault-auth
- name: Secrets
id: secrets
uses: hashicorp/vault-action@v2
with:
url: ${{ steps.vault-auth.outputs.addr }}
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
token: ${{ steps.vault-auth.outputs.token }}
secrets:
kv/data/teams/vagrant/slack webhook | slack_webhook;
kv/data/teams/vagrant/packet token | packet_token;
kv/data/teams/vagrant/packet project_id | packet_project_id;
kv/data/teams/vagrant/packet ssh_key_content | packet_ssh_key_content;
- name: Code Checkout
uses: actions/checkout@v3
- name: Create packet instance
run: ./.ci/spec/create-packet.sh
working-directory: ${{github.workspace}}
env:
PACKET_EXEC_TOKEN: ${{ steps.secrets.outputs.packet_token }}
PACKET_EXEC_PROJECT_ID: ${{ steps.secrets.outputs.packet_project_id }}
PACKET_SSH_KEY_CONTENT: ${{ steps.secrets.outputs.packet_ssh_key_content }}
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
setup-hosts:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.nano']
name: Vagrant-Spec Start Hosts
needs: setup-packet
strategy:
matrix:
host_os: ['hashicorp/bionic64']
guest_os: ['hashicorp-vagrant/ubuntu-16.04']
providers: ['virtualbox', 'docker']
steps:
- name: Code Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Create hosts for tests (provider ${{ matrix.providers }})
run: ./.ci/spec/create-hosts.sh
working-directory: ${{github.workspace}}
env:
PACKET_EXEC_TOKEN: ${{ steps.secrets.outputs.packet_token }}
PACKET_EXEC_PROJECT_ID: ${{ steps.secrets.outputs.packet_project_id }}
PACKET_SSH_KEY_CONTENT: ${{ steps.secrets.outputs.packet_ssh_key_content }}
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_PRERELEASE_VERSION: ${{ github.event.client_payload.prerelease_version }}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
spec-tests:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: ['self-hosted', 'ondemand', 'linux', 'type=t3.nano']
name: Vagrant-Spec Tests
needs: setup-hosts
strategy:
matrix:
host_os: ['hashicorp/bionic64']
guest_os: ['hashicorp-vagrant/ubuntu-16.04']
docker_images: ['nginx']
providers: ['virtualbox', 'docker']
steps:
- name: Run Tests with host ${{ matrix.host_os }} using provider ${{ matrix.providers }}
run: ./.ci/spec/run-test.sh
working-directory: ${{github.workspace}}
env:
PACKET_EXEC_TOKEN: ${{ steps.secrets.outputs.packet_token }}
PACKET_EXEC_PROJECT_ID: ${{ steps.secrets.outputs.packet_project_id }}
PACKET_SSH_KEY_CONTENT: ${{ steps.secrets.outputs.packet_ssh_key_content }}
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
VAGRANT_DOCKER_IMAGES: ${{matrix.docker_images}}
- name: Pull log from guest
if: always()
run: ./.ci/spec/pull-log.sh
env:
PACKET_EXEC_TOKEN: ${{ steps.secrets.outputs.packet_token }}
PACKET_EXEC_PROJECT_ID: ${{ steps.secrets.outputs.packet_project_id }}
PACKET_SSH_KEY_CONTENT: ${{ steps.secrets.outputs.packet_ssh_key_content }}
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
VAGRANT_DOCKER_IMAGES: ${{matrix.docker_images}}
- name: Upload log
if: always()
uses: actions/upload-artifact@v3
with:
name: vagrant-spec-${{matrix.providers}}.log
path: ${{ github.workspace }}/vagrant-spec.log
notify-on-success:
if: github.repository == 'hashicorp/vagrant-acceptance' && success()
runs-on: self-hosted
name: Notify on Success
needs: spec-tests
steps:
- name: Notify on Success
run: ./.ci/spec/notify-success.sh
env:
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
cleanup:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: self-hosted
name: Cleanup Post Vagrant-Spec Tests
needs: [spec-tests, notify-on-success]
steps:
- name: Clean Packet
run: ./.ci/spec/clean-packet.sh
env:
PACKET_EXEC_TOKEN: ${{ steps.secrets.outputs.packet_token }}
PACKET_EXEC_PROJECT_ID: ${{ steps.secrets.outputs.packet_project_id }}
PACKET_SSH_KEY_CONTENT: ${{ steps.secrets.outputs.packet_ssh_key_content }}
SLACK_WEBHOOK: ${{ steps.secrets.outputs.slack_webhook }}
- name: Clean Workspace
run: rm -rf ${{ github.workspace }}