forked from mage-os/github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (145 loc) · 5.73 KB
/
nx-integration-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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: NX Integration Test
#description: Workflow to run NX assisted integration tests for Mage-OS projects.
on:
workflow_call:
inputs:
repository:
type: string
description: "Repository"
required: true
pr_head:
type: string
description: "head SHA"
required: true
pr_base:
type: string
description: "pr base SHA"
required: true
workflow_dispatch:
inputs:
repository:
type: string
description: "Repository"
required: true
pr_head:
type: string
description: "head SHA"
required: true
pr_base:
type: string
description: "pr base SHA"
required: true
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: debug
shell: bash
env:
repository: ${{ inputs.repository }}
pr_head: ${{ inputs.pr_head }}
pr_base: ${{ inputs.pr_base }}
run: |
echo "input was"
echo "repository: ${repository}"
echo "pr_head: ${pr_head}"
echo "pr_base: ${pr_base}"
matrix-calculator:
outputs:
php_versions: ${{ steps.calculate-matrix.outputs.php_versions }}
database_versions: ${{ steps.calculate-matrix.outputs.database_versions }}
search_versions: ${{ steps.calculate-matrix.outputs.search_versions }}
message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }}
cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }}
http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }}
runs-on: ubuntu-latest
steps:
- name: Run Matrix Calulator
id: calculate-matrix
uses: mage-os/github-actions/supported-services-matrix-calculator@main
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.pr_head }}
- name: Calculated Result
shell: bash
env:
php_versions: ${{ steps.calculate-matrix.outputs.php_versions }}
database_versions: ${{ steps.calculate-matrix.outputs.database_versions }}
search_versions: ${{ steps.calculate-matrix.outputs.search_versions }}
message_queue_versions: ${{ steps.calculate-matrix.outputs.message_queue_versions }}
cache_versions: ${{ steps.calculate-matrix.outputs.cache_versions }}
http_cache_versions: ${{ steps.calculate-matrix.outputs.http_cache_versions }}
run: |
echo "PHP Versions: $php_versions"
echo "database_versions: $database_versions"
echo "search_versions: $search_versions"
echo "message_queue_versions: $message_queue_versions"
echo "cache_versions: $cache_versions"
echo "http_cache_versions: $http_cache_versions"
nx-project-setup:
runs-on: ubuntu-latest
steps:
- name: Run Nx Project Setup
uses: mage-os/github-actions/nx-integration-tests-setup@main
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.pr_head }}
pr_base: ${{ inputs.pr_base }}
integration-tests:
needs:
- matrix-calculator
- nx-project-setup
strategy:
fail-fast: false
matrix:
php_version: ${{ fromJSON(needs.matrix-calculator.outputs.php_versions) }}
database_version: ${{ fromJSON(needs.matrix-calculator.outputs.database_versions) }}
search_version: ${{ fromJSON(needs.matrix-calculator.outputs.search_versions) }}
message_queue_version: ${{ fromJSON(needs.matrix-calculator.outputs.message_queue_versions) }}
cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.cache_versions) }}
http_cache_version: ${{ fromJSON(needs.matrix-calculator.outputs.http_cache_versions) }}
runs-on: ubuntu-latest
steps:
- name: Project Cache
uses: actions/cache/restore@v3
with:
path: main
key: ${{ runner.os }}-project-${{ inputs.ref }}
# could probably swap this to a docker container in future
- name: Install NX
working-directory: ./main
run: |
npm install -g nx@^15.4
- name: Print Affected
working-directory: ./main
run: |
AFFECTED_OUTPUT=/tmp/affect.json
nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT}
cat ${AFFECTED_OUTPUT}
echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})"
- name: Setup Warden Environment
uses: mage-os/github-actions/warden/setup-environment@main
with:
php_version: ${{ matrix.php_version }}
database: ${{ matrix.database_version }}
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
varnish: ${{ matrix.http_cache_version }}
base_directory: "./main"
- name: Setup config for Integration tests
uses: mage-os/github-actions/warden/integration-tests@main
with:
search: ${{ matrix.search_version }}
rabbitmq: ${{ matrix.message_queue_version }}
redis: ${{ matrix.cache_version }}
run_memory_test: 0
run_magento_integration_tests: 0
run_magento_integration_tests_real_suite: 0
base_directory: "./main"
- name: Run Integration Tests (Real)
working-directory: ./main
run: |
export WARDEN="$(dirname $(pwd))/warden/bin/warden"
nx affected --target=test:integration --head=HEAD --base=remotes/origin/${{ inputs.pr_base }}