Skip to content

Merge pull request #24 from CIROH-UA/ngen-latest #50

Merge pull request #24 from CIROH-UA/ngen-latest

Merge pull request #24 from CIROH-UA/ngen-latest #50

name: Build and Push Singularity Image
on:
push:
branches:
- main
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: X86
defaults:
run:
shell: bash
working-directory: ./singularity
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build Singularity Image
run: |
sudo singularity build ciroh-ngen-singularity.sif singularity_ngen.def
- name: Test
run: |
rm -rf /home/ubuntu/workspace/AWI_16_2853886_006/partitions*.json
rm -rf /home/ubuntu/workspace/AWI_16_2853886_006/*.csv
rm -rf /home/ubuntu/workspace/AWI_16_2853886_006/*.parquet
rm -rf /home/ubuntu/workspace/AWI_16_2853886_006/outputs/*/*
singularity run --bind /home/ubuntu/workspace/AWI_16_2853886_006:/ngen/ngen/data ciroh-ngen-singularity.sif "/ngen/ngen/data auto 2"
output_count=`ls /home/ubuntu/workspace/AWI_16_2853886_006/outputs/* | wc -l`
if [[ "$output_count" < 1 ]]; then
echo "No outputs found"
exit 1
else
echo "Test run successfully"
fi
- name: Sign Singularity Image
run: |
singularity sign --keyidx 0 ciroh-ngen-singularity.sif <<EOF
${{ secrets.KEY_PASSPHRASE }}
EOF
- name: Login and Push Singularity Image
env:
SYLABS_AUTH_TOKEN: ${{ secrets.SYLABS_AUTH_TOKEN }}
run: |
# Debug: Check token length (don't print the actual token)
echo "Token length: ${#SYLABS_AUTH_TOKEN}"
# Create a temporary file for the token
TOKEN_FILE=$(mktemp)
echo "$SYLABS_AUTH_TOKEN" > "$TOKEN_FILE"
# Debug: Check file content length
echo "Token file content length: $(wc -c < "$TOKEN_FILE")"
# Attempt to login
if singularity remote login --tokenfile "$TOKEN_FILE"; then
echo "Login successful"
# Push the image
singularity push ciroh-ngen-singularity.sif library://ciroh-it-support/ngiab/ciroh-ngen-singularity:latest_x86
else
echo "Login failed"
exit 1
fi
# Clean up
rm "$TOKEN_FILE"