Skip to content

Commit a03b3fc

Browse files
committed
🔧 CI: migrate from Vagrant/macOS to Docker/Ubuntu multi-arch
Replace Vagrant-based CI with Docker-based testing due to nested virtualization not being supported on GitHub-hosted runners. Vagrant/VirtualBox requires nested virtualization which fails on both macOS and Ubuntu cloud VMs, making VM-based CI impossible. Docker containers provide a viable alternative that works on GitHub's infrastructure. Switch from macOS to Ubuntu runners (`ubuntu-latest` and `ubuntu-24.04-arm`) to enable multi-architecture testing on both `x86_64` and ARM64. Add docker-ci inventory host and `ci_skip` tags for Docker-incompatible tasks (GUI) or roles that are already tested elsewhere. Make the AiiDA daemon service conditional on platform to avoid `systemd` failures in containers. This enables CI that actually tests Ansible provisioning instead of just initialization, while validating architecture-specific package filtering works correctly on both platforms. Vagrant-based issues should be easily detected building locally.
1 parent 237d36d commit a03b3fc

File tree

3 files changed

+45
-20
lines changed

3 files changed

+45
-20
lines changed

.github/workflows/build-init.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,56 @@ on:
55
push:
66
branches: [main]
77
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
89
paths-ignore: ["docs/**"]
910
jobs:
1011
build-init:
11-
# this job initialises the vagrant box
12-
# then just runs some initial ansible tasks
13-
# for the full build, see build.yml
14-
runs-on: macos-latest
15-
env:
16-
VAGRANT_NO_GUI: true
17-
VAGRANT_ON_GH: true
12+
if: github.event.pull_request.draft == false
13+
# this job tests ansible provisioning in Docker containers
14+
# Tests on both ARM64 and AMD64 architectures using Ubuntu runners
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, ubuntu-24.04-arm]
1819

1920
steps:
2021
- uses: actions/checkout@v4
21-
- name: set up Python
22+
23+
- name: Set up Python
2224
uses: actions/setup-python@v5
2325
with:
24-
python-version: 3.9
26+
python-version: 3.13
2527

26-
- name: install pip requirements
28+
- name: Install pip requirements
2729
run: |
2830
pip install --upgrade pip
2931
pip install wheel
3032
pip install -r requirements.txt
3133
32-
- name: install ansible requirements
34+
- name: Install Ansible requirements
3335
run: ansible-galaxy install -r requirements.yml
3436

35-
- name: Build Vagrant Box
36-
run: ANSIBLE_ARGS="--tags init,ci_test" vagrant up
37+
- name: Install Docker collection for CI
38+
run: ansible-galaxy collection install community.docker
39+
40+
- name: Start Ubuntu Docker container
41+
run: |
42+
docker run -d --name quantum-mobile \
43+
-v ${{ github.workspace }}:/workspace \
44+
ubuntu:24.04 \
45+
sleep infinity
46+
47+
- name: Prepare container for Ansible
48+
run: docker exec quantum-mobile bash -c "apt-get update && apt-get install -y python3 sudo"
49+
50+
- name: Run Ansible provisioning
51+
run: ansible-playbook -v --limit docker-ci -e build_hosts=docker-ci --skip-tags ci_skip playbook-build.yml
52+
env:
53+
ANSIBLE_CALLBACKS_ENABLED: ansible.posix.profile_tasks
3754

3855
- name: Archive ansible log
56+
if: always()
3957
uses: actions/upload-artifact@v4
4058
with:
41-
name: ansible-log
59+
name: ansible-log-${{ matrix.os }}
4260
path: ansible.log

inventory.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ all:
6767
ansible_ssh_common_args: "-F vagrant-ssh"
6868
ansible_user: vagrant
6969

70+
docker-ci:
71+
cloud_platform: docker
72+
ansible_connection: community.docker.docker
73+
ansible_host: quantum-mobile
74+
ansible_user: root
75+
ansible_python_interpreter: /usr/bin/python3
76+
7077
docker:
7178
# see playbook-docker.yml to start container
7279
cloud_platform: docker

playbook-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@
6060
ansible.builtin.import_tasks: local/tasks/customise-bash.yml
6161

6262
- name: Install common text editors
63-
tags: [editors]
63+
tags: [editors, ci_skip]
6464
ansible.builtin.import_role:
6565
name: marvel-nccr.editors
6666
vars:
6767
editors_vm_user: "{{ vm_user }}"
6868

6969
- name: Add desktop GUI
70-
tags: [ubuntu_desktop]
70+
tags: [ubuntu_desktop, ci_skip]
7171
when: not vm_headless
7272
become: true
7373
block:
@@ -91,7 +91,7 @@
9191
ubuntu_desktop_wm_package: "{{ vm_wm_package }}"
9292

9393
- name: Customise GUI for QM
94-
tags: [customise-gui]
94+
tags: [customise-gui, ci_skip]
9595
when: not vm_headless
9696
become: true
9797
become_user: "{{ vm_user }}"
@@ -128,7 +128,7 @@
128128
packages: [grace, xcrysden, default-jre]
129129

130130
- name: Install SLURM service
131-
tags: [slurm]
131+
tags: [slurm, ci_skip]
132132
ansible.builtin.import_role:
133133
name: marvel-nccr.slurm
134134

@@ -250,10 +250,10 @@
250250
db_name: aiidadb
251251
db_username: aiida
252252
db_password: "ne9N_LDK-*JSS"
253-
daemon_service: true
253+
daemon_service: "{{ cloud_platform is not defined or cloud_platform != 'docker' }}"
254254

255255
- name: Create AiiDA Jupyter service
256-
tags: [aiida-jupyter]
256+
tags: [aiida-jupyter, ci_skip]
257257
become: true
258258
become_user: "{{ vm_user }}"
259259
ansible.builtin.import_tasks: local/tasks/aiida-jupyter.yml

0 commit comments

Comments
 (0)