Skip to content

Commit 860f464

Browse files
committed
github actions test
Signed-off-by: Jesus Paz <jeherpabo@gmail.com>
1 parent 803ebb6 commit 860f464

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Ansible Playbook Execution
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
run-playbook-ubuntu-amd64:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
ubuntu_version: [noble, jammy, focal]
20+
node_version: [18.x, 20.x, 22.x]
21+
container:
22+
image: ubuntu:${{ matrix.ubuntu_version }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Install Dependencies
26+
run: |
27+
apt-get update
28+
apt-get install -y lsb-release sudo curl python3 python3-pip python3-venv
29+
- name: Setup Virtual Environment
30+
run: |
31+
python3 -m venv venv
32+
./venv/bin/pip install --upgrade pip
33+
- name: Install Ansible and Requirements
34+
run: |
35+
./venv/bin/pip install -r requirements.txt
36+
./venv/bin/pip install ansible
37+
- name: Run Playbook
38+
run: |
39+
ANSIBLE_ROLES_PATH=../ ./venv/bin/ansible-playbook playbook.yml --extra-vars "nodejs_version=${{ matrix.node_version }}" --ask-become-pass
40+
- name: Check Installed Node.js Version
41+
shell: bash
42+
run: |
43+
NODE_VERSION_INSTALLED=$(node -v | cut -d. -f1 | sed 's/v//')
44+
NODE_VERSION_EXPECTED=$(echo "${{ matrix.node_version }}" | cut -d. -f1)
45+
if [[ "$NODE_VERSION_INSTALLED" != "$NODE_VERSION_EXPECTED" ]]; then
46+
echo "Node.js version mismatch: expected $NODE_VERSION_EXPECTED, got $NODE_VERSION_INSTALLED"
47+
exit 1
48+
else
49+
echo "Node.js version correctly installed: $NODE_VERSION_INSTALLED"
50+
fi
51+
52+
run-playbook-ubuntu-arm64:
53+
runs-on: ubuntu-22.04-arm
54+
strategy:
55+
matrix:
56+
ubuntu_version: [noble, jammy, focal]
57+
node_version: [18.x, 20.x, 22.x]
58+
container:
59+
image: ubuntu:${{ matrix.ubuntu_version }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
- name: Install Dependencies
63+
run: |
64+
apt-get update
65+
apt-get install -y lsb-release sudo curl python3 python3-pip python3-venv
66+
- name: Setup Virtual Environment
67+
run: |
68+
python3 -m venv venv
69+
./venv/bin/pip install --upgrade pip
70+
- name: Install Ansible and Requirements
71+
run: |
72+
./venv/bin/pip install -r requirements.txt
73+
./venv/bin/pip install ansible
74+
- name: Run Playbook
75+
run: |
76+
ANSIBLE_ROLES_PATH=../ ./venv/bin/ansible-playbook playbook.yml --extra-vars "nodejs_version=${{ matrix.node_version }}" --ask-become-pass
77+
- name: Check Installed Node.js Version
78+
shell: bash
79+
run: |
80+
NODE_VERSION_INSTALLED=$(node -v | cut -d. -f1 | sed 's/v//')
81+
NODE_VERSION_EXPECTED=$(echo "${{ matrix.node_version }}" | cut -d. -f1)
82+
if [[ "$NODE_VERSION_INSTALLED" != "$NODE_VERSION_EXPECTED" ]]; then
83+
echo "Node.js version mismatch: expected $NODE_VERSION_EXPECTED, got $NODE_VERSION_INSTALLED"
84+
exit 1
85+
else
86+
echo "Node.js version correctly installed: $NODE_VERSION_INSTALLED"
87+
fi

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ansible==11.2.0
1+
ansible

0 commit comments

Comments
 (0)