PENG-2585: CI to validate image #12
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
name: "Run image and test it" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
# call-build-workflow: | |
# name: call-build-workflow | |
# uses: ./.github/workflows/build-image.yml | |
# with: | |
# sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
validate-image: | |
name: validate-image | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Install image-factory | |
run: | | |
poetry env use "3.12" | |
poetry install | |
- name: Build democluster | |
run: | | |
poetry run image-factory build democluster | |
- name: Copy built image to target location | |
run: | | |
cp democluster/final/democluster.img . | |
- name: Install multipass | |
run: | | |
sudo snap install multipass | |
- name: run image | |
run: | | |
bash democluster/helpers/deploy_local_democluster.sh | |
- name: valitate snaps | |
run: | | |
SNAP_LIST=$(multipass exec democluster -- snap list) | |
SNAPS=("vantage-agent" "jobbergate-agent") | |
for SNAP in "${SNAPS[@]}"; do | |
if echo "$SNAP_LIST" | grep -q "$SNAP"; then | |
echo "$SNAP is installed." | |
else | |
echo "$SNAP is NOT installed." | |
exit 1 | |
fi | |
done | |
- name: check slurm is active | |
run: | | |
multipass exec democluster -- systemctl is-active slurmd | |
- name: test srun | |
run: | | |
multipass exec democluster -- srun ls | |
- name: check influx-db | |
run: | | |
multipass exec democluster -- systemctl is-active influxdb | |
- name: Cleanup | |
if: always() | |
run: | | |
echo "Performing cleanup..." | |
multipass stop democluster || true | |
multipass delete democluster -p || true | |
rm democluster.img || true | |
echo "Cleanup complete." |