-
Notifications
You must be signed in to change notification settings - Fork 8
179 lines (161 loc) · 6.11 KB
/
integration.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright (c) 2022, Solace Corporation, Ricardo Gomez-Ulmke, <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
name: integration tests
on:
# for testing
workflow_dispatch:
# push:
# branches:
# mtn-120
schedule:
- cron: '1 1 1 * *' # once per month
# - cron: '0 1 * * THU' # every thursday
# - cron: '0 5 * * *' # every day
# - cron: 0 22 */2 * * # every two days
pull_request:
branches:
- main
env:
DEBUG_FLAG: ${{ true }}
# DEBUG_FLAG: ${{ false }}
TEST_ANSIBLE_SOLACE_COLLECTION_DIR: "src/ansible_collections/solace/pubsub_plus"
TEST_TEST_RUNNER_SCRIPT: "test-runner/run.integration.sh"
TEST_TEST_RUNNER_LOGS_NAME: asc-test-runner-integration-logs
TEST_RUNNER_LOGS_DIR: integration-logs
jobs:
integration_test:
# runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
max-parallel: 1
fail-fast: false
matrix:
python-version: [ '3.8' ]
ansible-version: [
"ansible>6.0.0,<7.0.0", # this is 2.13
"ansible>=5.1.0,<6.0.0", # this is 2.12
# "ansible>=4.10.0,<5.0.0", # this is 2.11
# "ansible>=2.10.3,<2.11", # this is 2.10
]
steps:
- name: Check Auth
if: github.event_name == 'workflow_dispatch' && github.actor != 'ricardojosegomezulmke'
run: |
echo "not authorized"
echo "{IS_AUTHORIZED}={false}" >> $GITHUB_OUTPUT
id: auth
- name: Cancel Workflow
if: ${{ always() && steps.auth.outputs.IS_AUTHORIZED == 'false' }}
uses: andymckay/[email protected]
# - name: Install tools
# run: |
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64
# sudo add-apt-repository ppa:rmescandon/yq
# sudo apt update
# sudo apt install yq -y
- name: Print test env
if: env.DEBUG_FLAG == 'true'
run: |
env | grep TEST
which bash
bash --version
openssl version
tree --version
jq --version
# yq --version
- name: Print github env before checkout
if: env.DEBUG_FLAG == 'true'
run: |
pwd
# echo "GITHUB_SHA=$GITHUB_SHA"
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY"
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
echo "GITHUB_REF=$GITHUB_REF"
echo "github.event=${{ toJson(github.event) }}"
echo "github.event_name=${{ github.event_name }}"
- name: Checkout Current Branch
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Print Python Version
if: env.DEBUG_FLAG == 'true'
run: |
python -V
- name: Print AZ Version
if: env.DEBUG_FLAG == 'true'
run: |
az --version
- name: Install ansible and collection dependencies
env:
ANSIBLE_VERSION: "${{ matrix.ansible-version }}"
run: |
python -m pip install --upgrade pip
pip install "$ANSIBLE_VERSION"
pip install -r "${TEST_ANSIBLE_SOLACE_COLLECTION_DIR}/requirements.txt"
pip install -r tests/tests.requirements.txt
- name: Test Installation
if: env.DEBUG_FLAG == 'true'
run: |
echo ">>>>>>>> pip show ansible"
pip show ansible
echo ">>>>>>>> ansible --version"
ansible --version
echo ">>>>>>>> ansible-galaxy --version"
ansible-galaxy --version
echo ">>>>>>>> pip show xmltodict"
pip show xmltodict
echo ">>>>>>>> ls collection dir"
ls -la ${TEST_ANSIBLE_SOLACE_COLLECTION_DIR}
- name: Build and install collection
run: |
cd ${TEST_ANSIBLE_SOLACE_COLLECTION_DIR}
ansible-galaxy collection build .
ansible-galaxy collection install *.gz
- name: Test Collection Installation
if: env.DEBUG_FLAG == 'true'
run: |
pwd
ls -la
ansible-galaxy collection list -vvv solace.pubsub_plus
- name: Azure Login
# https://github.com/marketplace/actions/azure-login
uses: azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}
- name: Run Tests
run: |
mkdir -p ~/.ssh
echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
export ANSIBLE_PYTHON_INTERPRETER=$(python -c "import sys; print(sys.executable)")
CA_CERT_BUNDLE_FILE=$(python -m certifi)
export SSL_CERT_FILE=${CA_CERT_BUNDLE_FILE}
export REQUESTS_CA_BUNDLE=${CA_CERT_BUNDLE_FILE}
export PROJECT_HOME="$GITHUB_WORKSPACE"
export SOLACE_CLOUD_API_TOKEN_ALL_PERMISSIONS="${{ secrets.SOLACE_CLOUD_API_TOKEN_ALL_PERMISSIONS }}"
export SOLACE_CLOUD_API_TOKEN_RESTRICTED_PERMISSIONS="${{ secrets.SOLACE_CLOUD_API_TOKEN_RESTRICTED_PERMISSIONS }}"
export SOLACE_CLOUD_API_TOKEN_US="${{ secrets.SOLACE_CLOUD_API_TOKEN_ALL_PERMISSIONS }}"
export SOLACE_CLOUD_API_TOKEN_AU="${{ secrets.SOLACE_CLOUD_API_TOKEN_ALL_PERMISSIONS_SOLACE_AU }}"
export LOG_DIR="$GITHUB_WORKSPACE/${TEST_RUNNER_LOGS_DIR}"
export AZURE_PROJECT_NAME="asct-wf"
# source $PROJECT_HOME/test-runner/source.env.integration.core.sh
echo ">>>> running $TEST_TEST_RUNNER_SCRIPT"
./${TEST_TEST_RUNNER_SCRIPT}
- name: Test Logs Directory
if: env.DEBUG_FLAG == 'true'
run: |
export LOG_DIR="$GITHUB_WORKSPACE/${TEST_RUNNER_LOGS_DIR}"
tree $LOG_DIR
- name: Archive logs
if: ${{ (failure() && !cancelled()) || (always() && (github.event_name=='workflow_dispatch' || env.DEBUG_FLAG=='true') ) }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.TEST_TEST_RUNNER_LOGS_NAME }}
path: ${{ github.workspace }}/${{ env.TEST_RUNNER_LOGS_DIR }}
if-no-files-found: error
###
# The End.