CI testing
spack-stack CI testing is run by github workflow on a self-hosted runner, which we set up on an AWS instance. This section reviews how to set up a new workflow from scratch, beginning with launching an AWS instance.
Setting up an AWS Instance:
Prerequisites: admin privileges for the jcsda-usaf account
- Log into the
jcsda-usaf
AWS console using the regionus-east-2
- Navigate to the EC2.
- On the left hand side by, click "Instances". Then hit the top right orange button labeled "Launch instances". From here you can set up the instance. Below is an example of configuration used for a new spack-stack CI instance, which will be used to run the GNU tests.
Name and tags: <useful-name-for-spack-stack-ci>
Application and OS Images (Amazon Machine Image): Ubuntu Server 22.04 LTS (HVM), SSD Volume Type; Architecture: 64-bit (x86) or 64-bit (arm)
Instance type: c6a.8xlarge
Key pair: <your_key_pair>
Network settings:
VPC: ParallelClusterVPC
Subnet: public-us-east-2b
Firewall: Select existing security group
Common security group: global-ssh
Configure storage: 600 GB
Once everything is configured to your liking, click the orange "Launch instance" button. - Navigate to your newly created instance (in EC2 → Instance → <new_instance_id>) and click "connect". You can go to the "SSH client" side and follow the instructions on the screen.
Install spack-stack on AWS Instance:
- After you are logged into the instance, the next step is to set up and install spack-stack. As user
ubuntu
create the directory ~/spack-stack/manual_testing. - Follow the "Prerequisites: Ubuntu (one-off) instructions" from the spack-stack documentation. Note, use "apt" instead of "apt-get".
- The follow spack-stack instructions to "Create a new environment". While spack-stack is running the install, you can move on to set up the SWAP space.
Add SWAP space:
These steps are in reference to https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04.
Log into the AWS instance
- Running
free -h
will show no active swap running - Use
df -h
to check available space on the hard drive - Create the SWAP file with 64G by running
sudo fallocate -l 64G /swapfile
- You can verify the size of the swapfile using
ls -lh /swapfile
Next we will enable the swapfile using the following step:
sudo chmod 600 /swapfile ls -lh /swapfile sudo mkswap /swapfile # mark the file as swap space sudo swapon /swapfile # enable sudo swapon --show # verify
Finally, make the swap file permanent:
sudo cp /etc/fstab /etc/fstab.bak echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab cat /etc/fstab # verify
Set up the CI runner:
- Create a new self-hosted runner at https://github.com/JCSDA/spack-stack/actions/runners?tab=self-hosted. You can use the default runner group, but pick a name that helps identify the purpose of the runner, such as "ubuntu-ci-c6a-x86_64". Keep the labels the same as the name. Note, the security token will change with each runner. An example PR is #1085
- Document the new self hosted runner in a txt file at https://github.com/JCSDA-internal/jedi-tools/tree/develop/CI-tools/selfhosted
- Add a new spack-stack workflow file in https://github.com/JCSDA/spack-stack/tree/develop/.github/workflows. It is easier to build off of an existing workflow file, but make sure your architecture is consistent and the runner name gets updated at multiple locations inside the yaml.