Skip to content

Commit 7bb0bd7

Browse files
committed
[TMP] test build
1 parent 9a52f29 commit 7bb0bd7

File tree

4 files changed

+74
-36
lines changed

4 files changed

+74
-36
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

.github/workflows/build-vagrant.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: set up Python
2929
uses: actions/setup-python@v5
3030
with:
31-
python-version: 3.9
31+
python-version: 3.13
3232

3333
- name: install pip requirements
3434
run: |

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: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
- name: Prepare for VM build
3-
43
hosts: "{{ build_hosts | default('vagrant-ssh') }}"
5-
gather_facts: false
64

75
pre_tasks:
86
- name: Test configuration
@@ -17,21 +15,14 @@
1715

1816
# Install headers for guest-additions. Use kernel-specific package because
1917
# linux-headers-generic can be broken on ARM64 (depends on non-existent version).
20-
- name: Get kernel version
21-
tags: [init]
22-
when: "inventory_hostname.startswith('vagrant')"
23-
ansible.builtin.command: uname -r
24-
register: uname
25-
changed_when: false
26-
2718
- name: Install linux-headers for guest-additions
2819
tags: [init]
2920
when: "inventory_hostname.startswith('vagrant')"
3021
become: true
3122
ansible.builtin.apt:
3223
update_cache: true
3324
cache_valid_time: 86400
34-
name: "linux-headers-{{ uname.stdout }}"
25+
name: "linux-headers-{{ ansible_kernel }}"
3526

3627
- name: Make local dist folder
3728
tags: [init]
@@ -53,17 +44,21 @@
5344
- name: Update system package managers (apt, pip)
5445
tags: [init]
5546
ansible.builtin.include_tasks: local/tasks/ensure-apt-pip.yml
47+
5648
- name: "Add QM user '{{ vm_user }}'"
57-
tags: [add_user, ci_test]
49+
tags: [add_user]
5850
ansible.builtin.import_tasks: local/tasks/add-qm-user.yml
51+
5952
- name: "Add release notes section for the operating system"
6053
tags: [release_notes]
6154
ansible.builtin.import_tasks: local/tasks/release-notes-system.yml
55+
6256
- name: Customise bash terminal for QM
6357
tags: [customise-bash]
6458
become: true
6559
become_user: "{{ vm_user }}"
6660
ansible.builtin.import_tasks: local/tasks/customise-bash.yml
61+
6762
- name: Install common text editors
6863
tags: [editors]
6964
ansible.builtin.import_role:
@@ -72,7 +67,7 @@
7267
editors_vm_user: "{{ vm_user }}"
7368

7469
- name: Add desktop GUI
75-
tags: [ubuntu_desktop]
70+
tags: [ubuntu_desktop, ci_skip]
7671
when: not vm_headless
7772
become: true
7873
block:
@@ -96,7 +91,7 @@
9691
ubuntu_desktop_wm_package: "{{ vm_wm_package }}"
9792

9893
- name: Customise GUI for QM
99-
tags: [customise-gui]
94+
tags: [customise-gui, ci_skip]
10095
when: not vm_headless
10196
become: true
10297
become_user: "{{ vm_user }}"
@@ -144,11 +139,13 @@
144139
become: true
145140
become_user: "{{ root_user }}"
146141
ansible.builtin.import_tasks: local/tasks/rabbitmq.yml
142+
147143
- name: Install PostrgeSQL server service
148144
tags: [postgresql]
149145
become: true
150146
become_user: "{{ root_user }}"
151147
ansible.builtin.import_tasks: local/tasks/postgresql.yml
148+
152149
- name: Install conda+mamba
153150
tags: [conda]
154151
ansible.builtin.import_role:
@@ -178,15 +175,20 @@
178175
# note here we specify exact versions of libxc/openmpi/mpich
179176
# this is because we want conda to re-use as many packages as possible
180177
# since re-used packages do not incur more disk memory usage
181-
# - {name: abinit, pkgs: [abinit=9, libxc=4.3.4, mpich=4.0.3]}
182-
# - {name: cp2k, pkgs: [cp2k=9.*=*openmpi*, libxc=5.2.3, openmpi=4.1.2]}
183-
# - {name: fleur, pkgs: [fleur=6, libxc=5.2.3, openmpi=4.1.2]}
178+
# Architecture support: x86_64 only
179+
- { name: abinit, pkgs: [abinit=9, libxc=4.3.4, mpich=4.0.3], arch: [x86_64] }
180+
- { name: cp2k, pkgs: [cp2k=9.*=*openmpi*, libxc=5.2.3, openmpi=4.1.2], arch: [x86_64] }
181+
- { name: fleur, pkgs: [fleur=6, libxc=5.2.3, openmpi=4.1.2], arch: [x86_64] }
182+
- { name: wannier90, pkgs: [wannier90=3, libxc=5.2.3, openmpi=4.1.2], arch: [x86_64] }
183+
# Architecture support: x86_64 and aarch64
184184
- { name: nwchem, pkgs: [nwchem] }
185185
- { name: qespresso, pkgs: [qe] }
186-
# - {name: siesta, pkgs: [siesta, libxc=5.2.3, openmpi=4.1.2]}
187186
- { name: yambo, pkgs: [yambo] }
188-
# - {name: wannier90, pkgs: [wannier90=3, libxc=5.2.3, openmpi=4.1.2]}
189187
- { name: visualise, pkgs: [jmol, gnuplot] }
188+
# Note: siesta supports x86_64 and osx-arm64 but NOT linux-aarch64
189+
# Uncomment if needed, but will fail on linux-aarch64
190+
# - {name: siesta, pkgs: [siesta, libxc=5.2.3, openmpi=4.1.2], arch: [x86_64]}
191+
when: item.arch is not defined or ansible_architecture in item.arch
190192
loop_control:
191193
label: "{{ item.name }}"
192194

@@ -222,7 +224,7 @@
222224
content: 'eval "$(_VERDI_COMPLETE=bash_source verdi)"'
223225
mode: "0644"
224226

225-
- name: Create an aiida-profile
227+
- name: Create an aiida-profile (full with PostgreSQL)
226228
tags: [aiida-profile]
227229
become: true
228230
become_user: "{{ vm_user }}"
@@ -241,13 +243,24 @@
241243
db_name: aiidadb
242244
db_username: aiida
243245
db_password: "ne9N_LDK-*JSS"
244-
daemon_service: true
246+
daemon_service: "{{ inventory_hostname != 'docker-ci' }}"
247+
248+
# Alternative: CI lightweight profile with SQLite (if PostgreSQL doesn't work)
249+
# - name: Create an aiida-profile (CI lightweight with SQLite)
250+
# when: inventory_hostname == 'docker-ci'
251+
# become: true
252+
# become_user: "{{ vm_user }}"
253+
# ansible.builtin.shell: |
254+
# ~/.conda/bin/conda run -n {{ aiida_conda_env }} verdi presto -p {{ aiida_profile }}
255+
# args:
256+
# creates: "~/.aiida/config.json"
245257

246258
- name: Create AiiDA Jupyter service
247-
tags: [aiida-jupyter]
259+
tags: [aiida-jupyter, ci_skip]
248260
become: true
249261
become_user: "{{ vm_user }}"
250262
ansible.builtin.import_tasks: local/tasks/aiida-jupyter.yml
263+
251264
- name: "Create AiiDA computers"
252265
tags: [aiida-computers]
253266
become: true

0 commit comments

Comments
 (0)