forked from coecms/cms-conda-singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
561 additions
and
231 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Build conda env | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
jobs: | ||
build: | ||
name: Build environment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: gadi.nci.org.au | ||
username: ${{secrets.GADI_USER}} | ||
key: ${{secrets.DEPLOY_KEY}} | ||
command_timeout: 120m | ||
script: | | ||
export SCRIPT_DIR=${{secrets.GADI_REPO_PATH}}/scripts | ||
eval $( grep ADMIN_DIR $SCRIPT_DIR/install_config.sh ) | ||
eval $( grep JOB_LOG_DIR $SCRIPT_DIR/install_config.sh ) | ||
cd $JOB_LOG_DIR | ||
qsub -N build_${{ inputs.environment }} -lncpus=1,mem=20GB,walltime=2:00:00,jobfs=50GB,storage=gdata/v45+scratch/v45+gdata/hh5+scratch/hh5 -v SCRIPT_DIR,CONDA_ENVIRONMENT=${{ inputs.environment }} -P kr06 -q copyq -Wblock=true -Wumask=037 "${SCRIPT_DIR}"/build.sh |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
name: Deploy conda env | ||
on: | ||
push: | ||
branches: main | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
jobs: | ||
deploy: | ||
name: Deploy environment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
### Latest at time of writing | ||
uses: actions/[email protected] | ||
- name: Sync repository to Gadi | ||
### Latest at time of writing | ||
uses: up9cloud/[email protected] | ||
env: | ||
HOST: gadi.nci.org.au | ||
TARGET: ${{secrets.GADI_REPO_PATH}} | ||
KEY: ${{secrets.DEPLOY_KEY}} | ||
USER: ${{secrets.GADI_USER}} | ||
- name: Deploy conda environment | ||
- name: Deploy environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: gadi.nci.org.au | ||
username: ${{secrets.GADI_USER}} | ||
key: ${{secrets.DEPLOY_KEY}} | ||
script: | | ||
export SCRIPT_DIR=${{secrets.GADI_REPO_PATH}}/scripts | ||
export CONDA_ENVIRONMENT=${{ inputs.environment }} | ||
eval $( grep ADMIN_DIR $SCRIPT_DIR/install_config.sh ) | ||
eval $( grep BUILD_STAGE_DIR $SCRIPT_DIR/install_config.sh ) | ||
"${SCRIPT_DIR}"/deploy.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Get changed conda envs | ||
on: | ||
workflow_call: | ||
outputs: | ||
matrix: | ||
value: ${{ jobs.generate_matrix.outputs.matrix }} | ||
jobs: | ||
generate_matrix: | ||
name: Determine changed environments | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.diff.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check changed environments | ||
id: diff | ||
run: | | ||
# See https://github.community/t/check-pushed-file-changes-with-git-diff-tree-in-github-actions/17220/10 | ||
### https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script | ||
if [ $GITHUB_BASE_REF ]; then | ||
# Pull Request | ||
git fetch origin $GITHUB_BASE_REF --depth=1 | ||
export DIFF=$( git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA ) | ||
echo "Diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA" | ||
else | ||
# Push | ||
git fetch origin ${{ github.event.before }} --depth=1 | ||
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA ) | ||
echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" | ||
fi | ||
json="{\"include\":[" | ||
for line in $DIFF; do | ||
if [[ $line =~ environments ]]; then | ||
env_name=$( basename ${line%/*} ) | ||
if ! [[ $json =~ $env_name ]]; then | ||
json="$json{\"environment\":\"$env_name\"}," | ||
fi | ||
fi | ||
done | ||
### https://github.com/actions/runner/issues/2947 | ||
echo "matrix=$( echo "${json%,}]}" | jq -r 'tostring' )" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Force environment update | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: "Environment to update" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Sync repository to Gadi | ||
uses: up9cloud/[email protected] | ||
env: | ||
HOST: gadi.nci.org.au | ||
TARGET: ${{secrets.GADI_REPO_PATH}} | ||
KEY: ${{secrets.DEPLOY_KEY}} | ||
USER: ${{secrets.GADI_USER}} | ||
- name: Create Admin dirs on Gadi | ||
uses: appleboy/[email protected] | ||
with: | ||
host: gadi.nci.org.au | ||
username: ${{secrets.GADI_USER}} | ||
key: ${{secrets.DEPLOY_KEY}} | ||
script: | | ||
source ${{secrets.GADI_REPO_PATH}}/scripts/install_config.sh | ||
source ${{secrets.GADI_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 | ||
build: | ||
needs: setup | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
environment: ${{ inputs.environment }} | ||
secrets: inherit | ||
|
||
test: | ||
needs: build | ||
uses: ./.github/workflows/test.yml | ||
with: | ||
environment: ${{ inputs.environment }} | ||
secrets: inherit | ||
|
||
deploy: | ||
needs: test | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
environment: ${{ inputs.environment }} | ||
secrets: inherit |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Build and test conda env | ||
on: pull_request | ||
jobs: | ||
generate_matrix: | ||
uses: ./.github/workflows/get_changed_env.yml | ||
|
||
setup: | ||
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 | ||
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@v41 | ||
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: Sync repository to Gadi | ||
### Latest at time of writing | ||
uses: up9cloud/[email protected] | ||
env: | ||
HOST: gadi.nci.org.au | ||
TARGET: ${{secrets.GADI_REPO_PATH}} | ||
KEY: ${{secrets.DEPLOY_KEY}} | ||
USER: ${{secrets.GADI_USER}} | ||
- name: Create Admin dirs on Gadi | ||
uses: appleboy/[email protected] | ||
with: | ||
host: gadi.nci.org.au | ||
username: ${{secrets.GADI_USER}} | ||
key: ${{secrets.DEPLOY_KEY}} | ||
script: | | ||
source ${{secrets.GADI_REPO_PATH}}/scripts/install_config.sh | ||
source ${{secrets.GADI_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 | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Deploy conda env | ||
on: | ||
push: | ||
branches: main | ||
jobs: | ||
generate_matrix: | ||
uses: ./.github/workflows/get_changed_env.yml | ||
|
||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
### Latest at time of writing | ||
uses: actions/checkout@v4 | ||
- name: Sync repository to Gadi | ||
### Latest at time of writing | ||
uses: up9cloud/[email protected] | ||
env: | ||
HOST: gadi.nci.org.au | ||
TARGET: ${{secrets.GADI_REPO_PATH}} | ||
KEY: ${{secrets.DEPLOY_KEY}} | ||
USER: ${{secrets.GADI_USER}} | ||
|
||
deploy: | ||
needs: [ generate_matrix, setup ] | ||
uses: ./.github/workflows/deploy.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 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Test conda env | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
jobs: | ||
test: | ||
name: Test environment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Test environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: gadi.nci.org.au | ||
username: ${{secrets.GADI_USER}} | ||
key: ${{secrets.DEPLOY_KEY}} | ||
script: | | ||
export SCRIPT_DIR=${{secrets.GADI_REPO_PATH}}/scripts | ||
eval $( grep ADMIN_DIR $SCRIPT_DIR/install_config.sh ) | ||
eval $( grep JOB_LOG_DIR $SCRIPT_DIR/install_config.sh ) | ||
cd $JOB_LOG_DIR | ||
qsub -N test_${{ inputs.environment }} -lncpus=4,mem=20GB,walltime=0:20:00,jobfs=50GB,storage=gdata/v45+scratch/v45+gdata/hh5+scratch/hh5 -v SCRIPT_DIR,CONDA_ENVIRONMENT=${{ inputs.environment }} -P kr06 -Wblock=true -Wumask=037 "${SCRIPT_DIR}"/test.sh |
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
Oops, something went wrong.