Skip to content

Update template

Update template #182

name: Build executable for Windows
on:
push:
branches: ["develop", "deploy"]
pull_request:
branches: ["develop", "deploy"]
release:
types: [published]
# Define needed TOPP tools here
env:
TOPP_TOOLS: "FLASHDeconv FLASHTnT DecoyDatabase"
jobs:
build-vue-js-component:
runs-on: ubuntu-latest
steps:
# Step to set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21'
# Step to clone the Vue.js repository
- name: Checkout Vue.js repository
uses: actions/checkout@v4
with:
repository: 't0mdavid-m/openms-streamlit-vue-component'
ref: 'FVdeploy'
path: 'openms-streamlit-vue-component'
- name: Install and build Vue.js component
run: |
cd openms-streamlit-vue-component
npm install
npm run build
- name: Upload dist as artifact
uses: actions/upload-artifact@v4
with:
name: vue-js-dist
path: openms-streamlit-vue-component/dist
build-openms:
runs-on: windows-latest
env:
OPENMS_VERSION: 3.0.0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: t0mdavid-m/OpenMS
ref: FVdeploy
path: 'OpenMS'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2' # 5.12.7 is broken https://bugreports.qt.io/browse/QTBUG-81715, > 5.15.2 is not available on official archives (https://github.com/miurahr/aqtinstall/issues/636)
host: 'windows' # default: win64_msvc2017_64
target: 'desktop'
install-deps: 'true'
cache: 'false'
aqtversion: '==3.1.*'
# https://github.com/marketplace/actions/visual-studio-shell
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Setup build tools
shell: bash
run: |
choco install ccache ninja cmake
## GH CLI "SHOULD BE" installed. Sometimes I had to manually install nonetheless. Super weird.
# https://github.com/actions/runner-images/blob/main/images/win/scripts/Installers/Install-GitHub-CLI.ps1
echo "C:/Program Files (x86)/GitHub CLI" >> $GITHUB_PATH
- name: Extract branch/PR infos
shell: bash
run: |
cd OpenMS
RUN_NAME_LOCAL=$(echo ${GITHUB_REF#refs/heads/} | tr / -)
echo "RUN_NAME=${RUN_NAME_LOCAL}" >> $GITHUB_ENV
echo "BASE_REF=$(gh pr view --json baseRefName -q .baseRefName || echo ${RUN_NAME_LOCAL})" >> $GITHUB_ENV
id: extract_branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache contrib
id: cache-contrib-win
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/OpenMS/contrib
key: ${{ runner.os }}-contrib3
- name: Load contrib build
if: steps.cache-contrib-win.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd OpenMS/contrib
# Download the file using the URL fetched from GitHub
gh release download -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz'
# Extract the archive
tar -xzf contrib_build-Windows.tar.gz
rm contrib_build-Windows.tar.gz
ls
- name: Setup ccache cache
uses: actions/cache@v3
with:
path: .ccache
key: ${{ runner.os }}-ccache-${{ env.RUN_NAME }}-${{ github.run_number }}
# Restoring: From current branch, otherwise from base branch, otherwise from any branch.
restore-keys: |
${{ runner.os }}-ccache-${{ env.RUN_NAME }}
${{ runner.os }}-ccache-${{ env.BASE_REF }}
${{ runner.os }}-ccache-
- name: Add THIRDPARTY
shell: bash
run: |
# initialize THIRDPARTY
cd OpenMS
git submodule update --init THIRDPARTY
cd ..
# add third-party binaries to PATH
# use flat THIRDPARTY structure
mkdir -p _thirdparty
cp -R OpenMS/THIRDPARTY/Windows/64bit/* _thirdparty/
cp -R OpenMS/THIRDPARTY/All/* _thirdparty/
# add third-party binaries to PATH
for thirdpartytool in ${{ github.workspace }}/_thirdparty/*
do
echo $thirdpartytool >> $GITHUB_PATH
done
- name: Build Windows
shell: bash
run: |
mkdir $GITHUB_WORKSPACE/OpenMS/bld/
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cibuild.cmake
env:
#OS_PREFIX_PATH: "${{ env.Qt5_DIR }}/lib/cmake;${{ env.Qt5_DIR }}"
OPENMS_CONTRIB_LIBS: "${{ github.workspace }}/OpenMS/contrib"
CI_PROVIDER: "GitHub-Actions"
CMAKE_GENERATOR: "Ninja"
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
ENABLE_STYLE_TESTING: "OFF"
ENABLE_TOPP_TESTING: "ON"
ENABLE_CLASS_TESTING: "ON"
WITH_GUI: "ON"
ADDRESS_SANITIZER: "Off"
BUILD_TYPE: "Release"
OPENMP: "Off"
USE_STATIC_BOOST: "On"
# BUILD_FLAGS: "-p:CL_MPCount=2" # For VS Generator and MSBuild
BUILD_FLAGS: "-j2" # Ninja will otherwise use all cores (doesn't go well in GHA)
CMAKE_CCACHE_EXE: "ccache"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 12
CCACHE_MAXSIZE: 400M
- name: Package
shell: bash
run: |
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cipackage.cmake
env:
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
PACKAGE_TYPE: zip
SEARCH_ENGINES_DIRECTORY: "${{ github.workspace }}/_thirdparty"
CI_PROVIDER: "GitHub-Actions"
CPACK_PACKAGE_FILE_NAME: "openms-package"
#- name: Test Windows
# shell: bash
# run: $LAUNCHER ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake
# env:
# LAUNCHER: ""
# SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
# CI_PROVIDER: "GitHub-Actions"
# BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
- name: Upload package as artifact
uses: actions/upload-artifact@v4
with:
name: openms-package
path: ${{ github.workspace }}/OpenMS/bld/*.zip
build-executable:
runs-on: windows-latest
needs: [build-openms, build-vue-js-component]
env:
PYTHON_VERSION: 3.11.0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download vue js as artifact
uses: actions/download-artifact@v4
with:
name: vue-js-dist
path: js-dist
- name: Download package as artifact
uses: actions/download-artifact@v4
with:
name: openms-package
path: openms-package
- name: Extract bin and share from package
run: |
cd openms-package
unzip "*.zip" -d .
cp -r openms-package/bin ../openms-bin
cp -r openms-package/share ../share
- name: Setup python embeddable version
run: |
mkdir python-${{ env.PYTHON_VERSION }}
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
- name: Install pip
run: |
curl -O https://bootstrap.pypa.io/get-pip.py
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
rm get-pip.py
- name: Uncomment 'import site' in python311._pth file
run: |
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
- name: Install Required Packages
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements.txt --no-warn-script-location
- name: Create run_app.bat file
run: |
echo '@echo off' > run_app.bat
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run app.py local' >> run_app.bat
- name: Create All-in-one executable folder
run: |
mkdir streamlit_exe
mkdir streamlit_exe/js-component
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
mv run_app.bat streamlit_exe
cp -r src streamlit_exe
cp -r pages streamlit_exe
cp -r assets streamlit_exe
cp -r example-data streamlit_exe
cp -r .streamlit streamlit_exe
cp openms-bin/*.dll streamlit_exe
cp -r share streamlit_exe/share
cp -r js-dist streamlit_exe/js-component/dist
cp app.py streamlit_exe
$files = $env:TOPP_TOOLS -split ' '
foreach ($file in $files) {
Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe"
}
- name: Delete OpenMS package artifact
uses: geekyeggo/delete-artifact@v5
with:
name: openms-package
- name: Compress streamlit_exe folder to OpenMS-App.zip
run: |
7z a OpenMS-App.zip ./streamlit_exe/* -r
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: OpenMS-App
path: OpenMS-App.zip
- name: Upload artifact as release asset
if: ${{ github.event_name == 'release' }}
id: upload-release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: OpenMS-App.zip
asset_name: OpenMS-App.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}