diff --git a/.github/workflows/apptainer.yml b/.github/workflows/apptainer.yml index 3542cf2..a0aa78e 100644 --- a/.github/workflows/apptainer.yml +++ b/.github/workflows/apptainer.yml @@ -28,41 +28,34 @@ jobs: sudo rm -rf /usr/share/dotnet sudo rm -rf "$AGENT_TOOLSDIRECTORY" - # Cache APT .deb packages - - name: Cache APT archives - uses: actions/cache@v3 - with: - path: /var/cache/apt/archives - key: ${{ runner.os }}-apt-cache-v1 - - # Cache Apptainer installation - - name: Cache Apptainer install - id: cache-apptainer - uses: actions/cache@v3 - with: - path: | - /usr/bin/apptainer - /usr/lib/apptainer - /etc/apptainer - key: ${{ runner.os }}-apptainer-v1 - - # Install Apptainer only if not cached - - name: Install Apptainer - if: steps.cache-apptainer.outputs.cache-hit != 'true' - run: | - sudo apt-get update - sudo apt-get install -y software-properties-common graphviz - sudo add-apt-repository -y ppa:apptainer/ppa - sudo apt-get update - sudo apt-get install -y apptainer - # Cache Apptainer image cache (~/.apptainer/cache) - name: Cache Apptainer images - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.apptainer/cache key: ${{ runner.os }}-apptainer-images-v1 + # Install Apptainer from GitHub releases (avoids flaky Launchpad PPA) + - name: Install Apptainer + env: + GH_TOKEN: ${{ github.token }} + run: | + APPTAINER_VERSION=$(curl -s -H "Authorization: Bearer ${GH_TOKEN}" \ + https://api.github.com/repos/apptainer/apptainer/releases/latest \ + | grep '"tag_name"' | cut -d'"' -f4 | sed 's/v//') + if [ -z "${APPTAINER_VERSION}" ]; then + echo "ERROR: Could not determine Apptainer version" >&2 + exit 1 + fi + wget -q "https://github.com/apptainer/apptainer/releases/download/v${APPTAINER_VERSION}/apptainer_${APPTAINER_VERSION}_amd64.deb" + sudo apt-get install -y "./apptainer_${APPTAINER_VERSION}_amd64.deb" + rm -f "./apptainer_${APPTAINER_VERSION}_amd64.deb" + apptainer --version + + # Install graphviz + - name: Install graphviz + run: sudo apt-get install -y graphviz + # Checkout repository - name: Checkout repo uses: actions/checkout@v4