-
Notifications
You must be signed in to change notification settings - Fork 21
112 lines (101 loc) · 3.32 KB
/
db_agent_ci_win.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
name: "appdynamics.agents.db(win)"
on:
push:
paths:
- 'roles/db/**'
- 'molecule/db/**'
- 'molecule/base-windows.yml'
- '.github/workflows/db_agent_ci_win.yml'
- 'roles/common/**'
pull_request:
paths:
- 'roles/db/**'
- 'molecule/db/**'
- 'molecule/base-windows.yml'
- '.github/workflows/db_agent_ci_win.yml'
- 'roles/common/**'
jobs:
molecule:
runs-on: windows-2019
strategy:
fail-fast: true
matrix:
distro:
# - windows2016
- windows2019
collection_role:
- db
defaults:
run:
shell: wsl-bash {0}
steps:
- name: Set git to use LF
shell: cmd
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out code
uses: actions/checkout@v2
# - name: Allow basic auth
# shell: powershell
# run: |
# Set-Item -Path WSMan:\localhost\Service\Auth\Basic -Value $true
- name: Prepare WinRM
shell: cmd
run: |
winrm quickconfig -q -force
winrm enumerate winrm/config/Listener
- name: Create user
shell: cmd
env:
WINRM_PASSWORD: ${{ secrets.WINRM_PASSWORD }}
run: |
net user appdynamics "%WINRM_PASSWORD%" /add /passwordchg:no /passwordreq:yes /active:yes /Y
net localgroup Administrators appdynamics /add
# https://github.com/marketplace/actions/setup-wsl#action
- name: Setup WSL
uses: Vampire/setup-wsl@v1
with:
wsl-shell-command: bash -e -u -o pipefail
- name: Update path in WSL
run: |
echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.vars
source ~/.vars
echo $PATH
- name: Checkout pip cache
uses: actions/cache@v2
with:
path: ./pip-cache
key: ${{ runner.os }}-pip-ansible-${{ hashFiles('molecule/requirements-windows.txt') }}
restore-keys: |
${{ runner.os }}-pip-ansible
- name: Install Ansible and test dependencies in WSL
run: |
echo $PATH
source ~/.vars
mkdir -p ./pip-cache
sudo apt-get update
sudo apt-get install jq curl python3-pip git libffi-dev libssl-dev -y
pip3 install --cache-dir=./pip-cache --user -r molecule/requirements-windows.txt
- name: Build the collection
run: |
source ~/.vars
collection_file=$( basename $(ansible-galaxy collection build -f | awk -F" " '{print $NF}'))
echo $collection_file
echo "COLLECTION_FILE=$collection_file" >> ~/.vars
- name: Install the collection
run: |
source ~/.vars
ansible-galaxy collection install $COLLECTION_FILE
- name: Run role tests
run: >-
source ~/.vars &&
molecule --version &&
ansible --version &&
molecule --base-config molecule/base-windows.yml --debug test -s ${{ matrix.collection_role }}
env:
PY_COLORS: '1'
WINRM_PASSWORD: ${{ secrets.WINRM_PASSWORD }}
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
WSLENV: PY_COLORS:WINRM_PASSWORD:ANSIBLE_FORCE_COLOR:MOLECULE_DISTRO