-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'BerkhanBerkdemir-implement-actions-ci-pipeline'
- Loading branch information
Showing
4 changed files
with
156 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,64 @@ | ||
--- | ||
# Copyright (C) 2021 Maciej Delmanowski <[email protected]> | ||
# Copyright (C) 2021 DebOps <https://debops.org/> | ||
# Copyright (C) 2023 Berkhan Berkdemir <[email protected]> | ||
# Copyright (C) 2021-2024 DebOps <https://debops.org/> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
# TODO: The CI pipeline is not finished yet, it needs more work around | ||
# preparing the environment and Ansible configuration for execution. | ||
|
||
name: DebOps CI pipeline | ||
on: [ 'workflow_dispatch' ] | ||
name: 'DebOps CI Pipeline' | ||
on: [ 'push', 'pull_request' ] | ||
|
||
jobs: | ||
bootstrap_playbook: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
||
- name: Apply the playbook on the host | ||
env: | ||
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
debops run bootstrap --diff | ||
debops run bootstrap --diff | ||
common_playbook: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
||
- name: Apply the playbook on the host | ||
env: | ||
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
debops run common --diff | ||
debops run common --diff | ||
apt_role: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Check out the repository | ||
uses: 'actions/checkout@v3' | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
@@ -25,6 +68,7 @@ jobs: | |
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
debops run service/apt --diff | ||
debops run service/apt --diff | ||
|
@@ -34,8 +78,8 @@ jobs: | |
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Check out the repository | ||
uses: 'actions/checkout@v3' | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
@@ -45,17 +89,18 @@ jobs: | |
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
debops run service/apt_listchanges --diff | ||
debops run service/apt_listchanges --diff | ||
python_role: | ||
mariadb_server_role: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Check out the repository | ||
uses: 'actions/checkout@v3' | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
@@ -65,27 +110,61 @@ jobs: | |
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
printf "[debops_service_python]\nlocalhost\n" >> ansible/inventory/hosts | ||
debops run service/python --diff | ||
debops run service/python --diff | ||
cat <<EOL >> ansible/inventory/hosts | ||
[debops_service_mariadb_server] | ||
localhost | ||
EOL | ||
debops run service/mariadb_server --diff | ||
debops run service/mariadb_server --diff | ||
common_playbook: | ||
postgresql_server_role: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Check out the repository | ||
uses: 'actions/checkout@v3' | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
||
- name: Apply the playbook on the host | ||
- name: Apply the role on the host | ||
env: | ||
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
debops common --diff | ||
debops common --diff | ||
cat <<EOL >> ansible/inventory/hosts | ||
[debops_service_postgresql_server] | ||
localhost | ||
EOL | ||
debops run service/postgresql_server --diff | ||
debops run service/postgresql_server --diff | ||
python_role: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare the CI pipeline environment | ||
uses: './.github/workflows/prepare-ci-pipeline' | ||
|
||
- name: Apply the role on the host | ||
env: | ||
PY_COLORS: 1 | ||
ANSIBLE_FORCE_COLOR: 1 | ||
run: | | ||
source venv/bin/activate | ||
cd ~/src/controller | ||
cat <<EOL >> ansible/inventory/hosts | ||
[debops_service_python] | ||
localhost | ||
EOL | ||
debops run service/python --diff | ||
debops run service/python --diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
# Copyright (C) 2021 Maciej Delmanowski <[email protected]> | ||
# Copyright (C) 2021 DebOps <https://debops.org/> | ||
# Copyright (C) 2023 Berkhan Berkdemir <[email protected]> | ||
# Copyright (C) 2021-2024 DebOps <https://debops.org/> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
name: Prepare CI pipeline environment | ||
|
@@ -12,16 +13,31 @@ runs: | |
|
||
- name: Add ~/.local/bin to $PATH | ||
run: 'printf "%s/.local/bin\n" "${HOME}" >> ${GITHUB_PATH}' | ||
shell: 'bash' | ||
shell: bash | ||
|
||
- name: Prepare test environment | ||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get remove --purge -yq ansible python python2.7 python2.7-minimal | ||
pip3 install --user --upgrade pip wheel "setuptools==65.7.0" | ||
pip3 install --user --upgrade Jinja2 ansible | ||
pip3 install --user . | ||
debops-init ~/src/controller | ||
printf "[debops_all_hosts]\nlocalhost ansible_connection=local\n" \ | ||
>> ~/src/controller/ansible/inventory/hosts | ||
shell: 'bash' | ||
sudo apt-get install build-essential python3-dev libffi-dev libssl-dev \ | ||
libsasl2-dev libldap2-dev libpq-dev python3-pip python3-psycopg2 | ||
shell: bash | ||
|
||
- name: Configure VirtualEnv and install Python dependencies | ||
run: | | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
pip install wheel "setuptools==65.7.0" | ||
pip install -r requirements-integration.txt | ||
pip install . | ||
shell: bash | ||
|
||
- name: Initialize DebOps project | ||
run: | | ||
source venv/bin/activate | ||
debops project init ~/src/controller | ||
cd ~/src/controller | ||
cat <<EOL >> ansible/inventory/hosts | ||
[debops_all_hosts] | ||
localhost ansible_connection=local | ||
EOL | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (C) 2023 Berkhan Berkdemir <[email protected]> | ||
# Copyright (C) 2024 DebOps <https://debops.org/> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
# List of Python packages used by GitHub CI pipeline for continuous integration | ||
|
||
ansible==8.0.0a1 | ||
ansible-core==2.15.0b2 | ||
cffi==1.16.0 | ||
cryptography==41.0.5 | ||
distro==1.8.0 | ||
dnspython==2.4.2 | ||
future==0.18.3 | ||
Jinja2==3.1.2 | ||
MarkupSafe==2.1.3 | ||
netaddr==0.9.0 | ||
packaging==23.2 | ||
passlib==1.7.4 | ||
pyasn1==0.5.0 | ||
pyasn1-modules==0.3.0 | ||
pycparser==2.21 | ||
pyOpenSSL==23.2.0 | ||
python-dotenv==1.0.0 | ||
python-ldap==3.4.3 | ||
pyxdg==0.28 | ||
PyYAML==6.0.1 | ||
resolvelib==0.8.1 | ||
toml==0.10.2 |