-
Notifications
You must be signed in to change notification settings - Fork 35
142 lines (124 loc) · 4.37 KB
/
deployment-tests.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
137
138
139
140
141
142
name: Deployment tests for built package
on:
workflow_call:
secrets:
GH_ACTIONS_SSH_DEPLOY_KEY_ENTERPRISE_REPO:
required: true
GH_ACTIONS_SSH_DEPLOY_KEY_NOVA_REPO:
required: true
GH_ACTIONS_SSH_DEPLOY_KEY_MISSION_PORTAL_REPO:
required: true
GH_ACTIONS_SSH_KEY_BUILD_ARTIFACTS_CACHE:
required: true
jobs:
deployment_tests:
name: Run simple deployment tests
runs-on: ubuntu-20.04
steps:
- name: Checkout Together Action
uses: actions/checkout@v3
with:
repository: cfengine/together-javascript-action
ref: main
ssh-key: ${{ secrets.GH_ACTIONS_SSH_DEPLOY_KEY_TOGETHER_REPO }}
ssh-known-hosts: github.com
- name: Action step
uses: ./
id: together
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Core
uses: actions/checkout@v3
with:
repository: cfengine/core
path: core
ref: ${{steps.together.outputs.core || github.base_ref}}
submodules: recursive
- name: Checkout Masterfiles
uses: actions/checkout@v3
with:
repository: cfengine/masterfiles
path: masterfiles
ref: ${{steps.together.outputs.masterfiles || github.base_ref}}
- name: Checkout Buildscripts
uses: actions/checkout@v3
with:
repository: cfengine/buildscripts
path: buildscripts
ref: ${{steps.together.outputs.buildscripts || github.base_ref}}
fetch-depth: 20
- name: Checkout Nova
uses: actions/checkout@v3
with:
repository: cfengine/nova
path: nova
ref: ${{steps.together.outputs.nova || github.base_ref}}
ssh-key: ${{ secrets.GH_ACTIONS_SSH_DEPLOY_KEY_NOVA_REPO }}
ssh-known-hosts: github.com
- name: Checkout Enterprise
uses: actions/checkout@v3
with:
repository: cfengine/enterprise
path: enterprise
ref: ${{steps.together.outputs.enterprise || github.base_ref}}
submodules: recursive
ssh-key: ${{ secrets.GH_ACTIONS_SSH_DEPLOY_KEY_ENTERPRISE_REPO }}
ssh-known-hosts: github.com
- name: Checkout Mission Portal
uses: actions/checkout@v3
with:
repository: cfengine/mission-portal
path: mission-portal
ref: ${{steps.together.outputs.mission-portal || github.base_ref}}
submodules: recursive
ssh-key: ${{ secrets.GH_ACTIONS_SSH_DEPLOY_KEY_MISSION_PORTAL_REPO }}
ssh-known-hosts: github.com
- name: get PACKAGE_SHA for package cache
run: echo "PACKAGE_SHA=$(buildscripts/ci/package-sha.sh)" | tee -a ${GITHUB_ENV}
- name: get SHA of buildscripts/deps-packaging last commit
run: echo "DEPS_SHA=$(git log --pretty='format:%h' -1 -- .)" | tee -a ${GITHUB_ENV}
working-directory: buildscripts/deps-packaging
- name: restore packages cache
uses: actions/cache/restore@v3
with:
path: packages
key: packages-${{ env.PACKAGE_SHA }}
restore-keys: |
packages-${{ env.PACKAGE_SHA }}
- name: Restore dependency cache
uses: actions/cache/restore@v3
with:
path: cache
key: deps-${{ github.base_ref }}-${{ env.DEPS_SHA }}
restore-keys: |
deps-${{ github.base_ref }}
deps-master
deps
- name: Build package in docker
id: build_package
env:
GH_ACTIONS_SSH_KEY_BUILD_ARTIFACTS_CACHE: ${{ secrets.GH_ACTIONS_SSH_KEY_BUILD_ARTIFACTS_CACHE }}
run: |
if [ ! -f packages/cfe*deb ]; then
buildscripts/ci/docker-build-package.sh
fi
- name: Run deployment tests
run: buildscripts/ci/docker-deployment-tests.sh
- name: Save dependency cache
uses: actions/cache/save@v3
with:
path: cache
key: deps-${{ github.base_ref }}-${{ env.DEPS_SHA }}
- name: Save packages cache
uses: actions/cache/save@v3
with:
path: packages
key: packages-${{ env.PACKAGE_SHA }}
- name: Save artifacts
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
artifacts
packages