-
Notifications
You must be signed in to change notification settings - Fork 47
87 lines (83 loc) · 3.02 KB
/
ci.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
name: Ansible Playbook Execution
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
jobs:
run-playbook-ubuntu-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu_version: [noble, jammy, focal]
node_version: [18.x, 20.x, 22.x]
container:
image: ubuntu:${{ matrix.ubuntu_version }}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y lsb-release sudo curl python3 python3-pip python3-venv
- name: Setup Virtual Environment
run: |
python3 -m venv venv
./venv/bin/pip install --upgrade pip
- name: Install Ansible and Requirements
run: |
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install ansible
- name: Run Playbook
run: |
ANSIBLE_ROLES_PATH=../ ./venv/bin/ansible-playbook playbook.yml --extra-vars "nodejs_version=${{ matrix.node_version }}" --ask-become-pass
- name: Check Installed Node.js Version
shell: bash
run: |
NODE_VERSION_INSTALLED=$(node -v | cut -d. -f1 | sed 's/v//')
NODE_VERSION_EXPECTED=$(echo "${{ matrix.node_version }}" | cut -d. -f1)
if [[ "$NODE_VERSION_INSTALLED" != "$NODE_VERSION_EXPECTED" ]]; then
echo "Node.js version mismatch: expected $NODE_VERSION_EXPECTED, got $NODE_VERSION_INSTALLED"
exit 1
else
echo "Node.js version correctly installed: $NODE_VERSION_INSTALLED"
fi
run-playbook-ubuntu-arm64:
runs-on: ubuntu-22.04-arm
strategy:
matrix:
ubuntu_version: [noble, jammy, focal]
node_version: [18.x, 20.x, 22.x]
container:
image: ubuntu:${{ matrix.ubuntu_version }}
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y lsb-release sudo curl python3 python3-pip python3-venv
- name: Setup Virtual Environment
run: |
python3 -m venv venv
./venv/bin/pip install --upgrade pip
- name: Install Ansible and Requirements
run: |
./venv/bin/pip install -r requirements.txt
./venv/bin/pip install ansible
- name: Run Playbook
run: |
ANSIBLE_ROLES_PATH=../ ./venv/bin/ansible-playbook playbook.yml --extra-vars "nodejs_version=${{ matrix.node_version }}" --ask-become-pass
- name: Check Installed Node.js Version
shell: bash
run: |
NODE_VERSION_INSTALLED=$(node -v | cut -d. -f1 | sed 's/v//')
NODE_VERSION_EXPECTED=$(echo "${{ matrix.node_version }}" | cut -d. -f1)
if [[ "$NODE_VERSION_INSTALLED" != "$NODE_VERSION_EXPECTED" ]]; then
echo "Node.js version mismatch: expected $NODE_VERSION_EXPECTED, got $NODE_VERSION_INSTALLED"
exit 1
else
echo "Node.js version correctly installed: $NODE_VERSION_INSTALLED"
fi