-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (93 loc) · 3.01 KB
/
test.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
name: 'build-test'
on:
push:
paths-ignore:
- '**.md'
schedule:
# Daily 5am australian/brisbane time (7pm UTC)
- cron: '0 19 * * *'
workflow_dispatch:
env:
SA_PASSWORD: ${{ secrets.DB_IMAGE_SA_PASSWORD }}
ADMIN_API_KEY: ${{ secrets.OD_IMAGE_ADMIN_API_KEY }}
SERVER_URL: 'http://localhost:8080'
jobs:
test:
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-CU27-ubuntu-20.04
env:
ACCEPT_EULA: Y
SA_PASSWORD: ${{ env.SA_PASSWORD }}
MSSQL_PID: Developer
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P \"$SA_PASSWORD\" -Q \"SELECT 1\" || exit 1"
--health-interval 10s
--health-timeout 3s
--health-retries 10
--health-start-period 10s
octopusserver:
image: octopusdeploy/octopusdeploy
env:
ACCEPT_EULA: Y
DB_CONNECTION_STRING: 'Server=sqlserver;Database=OctopusDeploy;User Id=sa;Password=${{ env.SA_PASSWORD }};'
ADMIN_API_KEY: ${{ env.ADMIN_API_KEY }}
ENABLE_USAGE: N
OCTOPUS_SERVER_BASE64_LICENSE: ${{ secrets.OCTOPUS_SERVER_BASE64_LICENSE }}
ports:
- 8080:8080
options: >-
--health-interval 10s
--health-retries 15
--health-start-period 10s
# https://github.com/dorny/test-reporter/issues/168
permissions:
statuses: write
checks: write
outputs:
deployment_results: ${{ steps.self_test.outputs.deployment_results }}
steps:
- uses: actions/checkout@v3
- name: Setup node 20
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install package dependencies
run: npm install
- name: Compile and run tests
id: npm_tests
env:
OCTOPUS_TEST_URL: ${{ env.SERVER_URL }}
OCTOPUS_TEST_API_KEY: ${{ env.ADMIN_API_KEY }}
run: npm run all
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: JEST Tests
path: 'reports/jest-*.xml'
reporter: jest-junit
- name: GitHub Action self-test
id: self_test
uses: ./
env:
OCTOPUS_URL: ${{ env.SERVER_URL }}
OCTOPUS_API_KEY: ${{ env.ADMIN_API_KEY }}
OCTOPUS_SPACE: 'Default'
with:
server_task_id: ${{ steps.npm_tests.outputs.gha_selftest_server_task_id }} # see integration.test.ts
- name: Echo success status from self-test
run: echo "Deployment succeeded = [${{ steps.self_test.outputs.task_state }}]"
- name: GitHub Action self-test-2
id: self_test_2
uses: ./
continue-on-error: true
env:
OCTOPUS_URL: ${{ env.SERVER_URL }}
OCTOPUS_API_KEY: ${{ env.ADMIN_API_KEY }}
OCTOPUS_SPACE: 'Default'
with:
server_task_id: 'ServerTasks-99999'
- name: Echo success status from self-test-2
run: echo "Deployment succeeded = [${{ steps.self_test_2.outputs.task_state }}]"