Skip to content

Commit

Permalink
github actions test
Browse files Browse the repository at this point in the history
Signed-off-by: Jesus Paz <jeherpabo@gmail.com>
  • Loading branch information
JesusPaz committed Feb 12, 2025
1 parent 803ebb6 commit 84b156d
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 7 deletions.
161 changes: 161 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
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-debian-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
debian_version: [bullseye, bookworm]
node_version: [18.x, 20.x, 22.x]
container:
image: debian:${{ matrix.debian_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
run-playbook-debian-arm64:
runs-on: ubuntu-22.04-arm
strategy:
matrix:
debian_version: [bullseye, bookworm]
node_version: [18.x, 20.x, 22.x]
container:
image: debian:${{ matrix.debian_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
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Currently, this role supports the following operating systems and releases:
- **Ubuntu 20.04 LTS** (Focal Fossa)
- **Ubuntu 22.04 LTS** (Jammy Jellyfish)
- **Ubuntu 24.04 LTS** (Noble Numbat)
- **Debian 10** (Buster)
- **Debian 11** (Bullseye)
- **Debian 12** (Bookworm)

Expand All @@ -23,8 +22,6 @@ To install and test this role locally, run:
ANSIBLE_ROLES_PATH=../ ansible-playbook playbook.yml --ask-become-pass
```

````
### Install via Ansible Galaxy

You can install this role directly from Ansible Galaxy:
Expand Down Expand Up @@ -72,5 +69,3 @@ Maintained by NodeSource.
## License

This code is licensed under the MIT License. See the included [LICENSE.md](./LICENSE.md) file for more details.
````
1 change: 0 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ galaxy_info:
- noble
- name: Debian
versions:
- buster
- bullseye
- bookworm
- name: EL
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ansible==11.2.0
ansible

0 comments on commit 84b156d

Please sign in to comment.