Skip to content

Initial setup of Payu environment #8

Initial setup of Payu environment

Initial setup of Payu environment #8

Workflow file for this run

name: Build and test conda env
on: pull_request
jobs:
generate_matrix:
uses: ./.github/workflows/get_changed_env.yml
build_base_image:
runs-on: ubuntu-latest
needs: generate_matrix
if: ${{ needs.generate_matrix.outputs.matrix != '{"include":[]}' }}
container:
image: quay.io/singularity/singularity:v3.11.4
options: --privileged
outputs:
built-container: ${{ steps.changed-container-def.outputs.containerdef_any_changed }}
steps:
- name: Checkout repository
### Latest at time of writing
uses: actions/checkout@v4
- name: Check if container definition has changed
id: changed-container-def
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v43.0.2
with:
files_yaml: |
containerdef:
- container/container.def
- name: Build container if definition has changed
if: steps.changed-container-def.outputs.containerdef_any_changed == 'true'
run: |
echo ${{ needs.generate_matrix.outputs.matrix }}
sudo -E singularity build container/base.sif container/container.def
- name: Upload base container
if: steps.changed-container-def.outputs.containerdef_any_changed == 'true'
uses: actions/upload-artifact@v4
with:
name: base-container
path: container/base.sif
setup:
runs-on: ubuntu-latest
needs: [ generate_matrix, build_base_image ]
if: ${{ needs.generate_matrix.outputs.matrix != '{"include":[]}' }}
environment: Gadi
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download base container
if: needs.build_base_image.outputs.built-container == 'true'
uses: actions/download-artifact@v4
with:
name: base-container
path: container
- name: Setup SSH
uses: access-nri/actions/.github/actions/setup-ssh@main
id: ssh
with:
hosts: |
${{ secrets.HOST }}
${{ secrets.HOST_DATA }}
private-key: ${{ secrets.SSH_KEY }}
- name: Create parent repository directories
run: |
ssh ${{ secrets.USER }}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
mkdir -p ${{ secrets.REPO_PATH }}
EOT
- name: Sync repository to Gadi
run: |
rsync -e 'ssh -i ${{ steps.ssh.outputs.private-key-path }}' \
-avz --delete --exclude=/.git/ --exclude=/.github/ \
./ \
${{ secrets.USER }}@${{ secrets.HOST_DATA }}:${{ secrets.REPO_PATH }}
- name: Create Admin dirs on Gadi
run: |
ssh ${{ secrets.USER }}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
source ${{ secrets.REPO_PATH }}/scripts/install_config.sh
source ${{ secrets.REPO_PATH }}/scripts/functions.sh
mkdir -p $ADMIN_DIR $JOB_LOG_DIR $BUILD_STAGE_DIR
set_admin_perms $ADMIN_DIR $JOB_LOG_DIR $BUILD_STAGE_DIR
EOT
build:
needs: [ generate_matrix, setup ]
uses: ./.github/workflows/build.yml
with:
environment: ${{ matrix.environment }}
secrets: inherit
if: ${{ needs.generate_matrix.outputs.matrix != '{"include":[]}' }}
strategy:
matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}}
max-parallel: 1
fail-fast: false
test:
needs: [ generate_matrix, build ]
uses: ./.github/workflows/test.yml
with:
environment: ${{ matrix.environment }}
secrets: inherit
if: ${{ needs.generate_matrix.outputs.matrix != '{"include":[]}' }}
strategy:
matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}}
max-parallel: 1
fail-fast: false