Skip to content

Build AppImage

Build AppImage #25

name: Build AppImage
on:
workflow_dispatch:
inputs:
package-name:
description: "Bambu AppImage name"
required: true
default: "bambu-gcc7_clang11"
branch:
description: "Repository branch to build from"
required: false
default: "main"
compilers:
description: "Comma separated list of compilers to include"
required: true
default: "gcc-7,clang-12"
build-compiler:
description: "Compiler used to build bambu (if not already included in compilers)"
required: false
default: "gcc-8"
configure:
description: "Bambu configuration options"
required: true
default: "--enable-glpk --enable-flopoco --enable-opt --with-opt-level=2 --enable-release CC=gcc-8 CXX=g++-8 --with-gcc8=/bin/false"
workflow_call:
inputs:
package-name:
description: "Bambu AppImage package name"
required: true
type: string
compilers:
description: "Comma separated list of compilers to include"
required: false
type: string
default: "gcc-7,clang-12"
build-compiler:
description: "Compiler used to build bambu (if not already included in compilers)"
required: false
type: string
default: "gcc-8"
configure:
description: "Bambu configuration options"
required: false
type: string
default: "--enable-glpk --enable-flopoco --enable-opt --with-opt-level=2 --enable-release CC=gcc-8 CXX=g++-8 --with-gcc8=/bin/false"
upload_config:
description: "Upload configuration <CI|release|both>"
required: false
type: string
default: "CI"
secrets:
CI_STORAGE_URL:
required: true
CI_STORAGE_USER:
required: true
CI_STORAGE_TOKEN:
required: true
outputs:
package-name:
description: "Package name to download built AppImage"
value: ${{jobs.build.outputs.package-name}}
env:
compilers: ${{inputs.compilers}}
build-compiler: ${{inputs.build-compiler}}
configure: ${{inputs.configure}}
storage-url: ${{secrets.CI_STORAGE_URL}}
storage-user: ${{secrets.CI_STORAGE_USER}}
storage-token: ${{secrets.CI_STORAGE_TOKEN}}
storage-path: release
package-name: ${{inputs.package-name}}
dist-dir: dist
bcompiler-dir: compiler
host_jobs: $J
upload_config: ${{inputs.upload_config}}
local-compilers-backup: $LOCAL_COMPILERS_BACKUP
jobs:
build:
runs-on: [self-hosted]
outputs:
package-name: ${{env.package-name}}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{inputs.branch}}
- name: Env setup
id: setup
shell: bash
run: |
echo "Current host supports ${{env.host_jobs}} parallel jobs"
echo "jobs=${{env.host_jobs}}" >> $GITHUB_OUTPUT
env_id="$(echo $(sed 's/,/\n/g' <<< "${{env.compilers}}" | sort -V) | sed 's/ //g')"
if [[ ! -z "${{env.build-compiler}}" ]]; then
if [[ "$env_id" != *"${{env.build-compiler}}"* ]]; then
env_id+="${{env.build-compiler}}"
fi
fi
echo "version=$(cat configure.ac | grep AC_INIT | sed -E 's/.*,(.*),.*/\1/g;s/ //g')" >> $GITHUB_OUTPUT
echo "env_id=$env_id" >> $GITHUB_OUTPUT
echo "timestamp=$(date -u +'%Y-%m-%d-%H;%M;%S')" >> $GITHUB_OUTPUT
- name: CCache cache files
uses: actions/cache@v3
with:
path: .ccache
key: panda-build-ccache-${{steps.setup.outputs.version}}-${{ steps.setup.outputs.timestamp }}
restore-keys: |
panda-build-ccache-${{steps.setup.outputs.version}}-
- name: Autoconf cache files
uses: actions/cache@v3
with:
path: .autoconf
key: panda-build-autoconf-${{steps.setup.outputs.version}}-${{ steps.setup.outputs.env_id }}-${{ steps.setup.outputs.timestamp }}
restore-keys: |
panda-build-autoconf-${{steps.setup.outputs.version}}-${{ steps.setup.outputs.env_id }}-
- name: Download compilers
shell: bash
run: |
mkdir ${{env.dist-dir}}
bash ./.devcontainer/library-scripts/compiler-download.sh "${{env.dist-dir}}" "${{env.compilers}}" "${{env.local-compilers-backup}}"
if [[ ! -z "${{env.build-compiler}}" ]]; then
mkdir ${{env.bcompiler-dir}}
bash ./.devcontainer/library-scripts/compiler-download.sh "${{env.bcompiler-dir}}" "${{env.build-compiler}}" "${{env.local-compilers-backup}}"
fi
- name: Build Bambu application
id: build
uses: ./.github/actions/generate-appimage
with:
config-args: ${{env.configure}} --enable-Werror
jobs: ${{steps.setup.outputs.jobs}}
- name: Upload PandA Bambu HLS AppImage for CI
if: ${{ env.upload_config != '' && env.upload_config != 'release' }}
uses: ./.github/actions/storage-upload
with:
name: ${{env.package-name}}
path: ${{steps.build.outputs.appimage}}
storage-url: ${{env.storage-url}}
username: "${{env.storage-user}}"
password: "${{env.storage-token}}"
storage-compression: false
- name: Upload Panda Bambu HLS Release
if: ${{ env.upload_config != 'CI' }}
shell: bash
run: |
APP_FILE="${{env.package-name}}.AppImage"
STORAGE_URL="${{env.storage-url}}/${{env.storage-path}}/$APP_FILE"
curl -L --fail -u '${{env.storage-user}}':'${{env.storage-token}}' -T "${{steps.build.outputs.appimage}}" "$STORAGE_URL"
echo "### New release available at https://release.bambuhls.eu/appimage/$APP_FILE" >> $GITHUB_STEP_SUMMARY