Skip to content

release

release #9

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
description: "Application version"
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
APPLICATION_NAME: realesrgan-ncnn-vulkan
jobs:
setup:
runs-on: ubuntu-latest
outputs:
APPNAME: ${{ steps.get_appname.outputs.APPNAME }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: get-appname
id: get_appname
run: echo ::set-output name=APPNAME::${APPLICATION_NAME}
- name: get-version
id: get_version
run: echo ::set-output name=VERSION::${{ github.event.inputs.version }}
ubuntu:
needs: [setup]
runs-on: ubuntu-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v1
with:
path: "1.3.261.1"
key: vulkansdk-linux-x86_64-1.3.261.1
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://sdk.lunarg.com/sdk/download/1.3.261.1/linux/vulkansdk-linux-x86_64-1.3.261.1.tar.xz?Human=true -O vulkansdk-linux-x86_64-1.3.261.1.tar.xz
tar -xf vulkansdk-linux-x86_64-1.3.261.1.tar.xz
rm -rf 1.3.261.1/source 1.3.261.1/samples
find 1.3.261.1 -type f | grep -v -E 'vulkan|glslang' | xargs rm
- name: build
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9 g++-9
export CXX="g++-9" CC="gcc-9"
export VULKAN_SDK=`pwd`/1.3.261.1/x86_64
mkdir build && cd build
cmake ../src
cmake --build . -j 2
- name: package
# cp -r models/* ${{ env.PACKAGENAME }}
run: |
mkdir -p ${{ env.PACKAGENAME }}
cp README.md LICENSE ${{ env.PACKAGENAME }}
cp build/${{ needs.setup.outputs.APPNAME }} ${{ env.PACKAGENAME }}
strip -g ${{ env.PACKAGENAME }}/${{ needs.setup.outputs.APPNAME }}
zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
openmp-macos:
runs-on: macos-latest
steps:
- name: cache-openmp
id: cache-openmp
uses: actions/cache@v1
with:
path: openmp-install
key: openmp-macos-release-17.0.2
- name: checkout
if: steps.cache-openmp.outputs.cache-hit != 'true'
uses: actions/checkout@v2
- name: Setup CMake
uses: threeal/cmake-action@v1.3.0
with:
run-build: false
run-test: false
- name: openmp
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.2/openmp-17.0.2.src.tar.xz
tar -xf openmp-17.0.2.src.tar.xz
cd openmp-17.0.2.src
sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S
sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S
- name: build-x86_64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-17.0.2.src
mkdir build-x86_64 && cd build-x86_64
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=install -D CMAKE_OSX_ARCHITECTURES="x86_64" \
-D LIBOMP_ENABLE_SHARED=OFF -D LIBOMP_OMPT_SUPPORT=OFF -D LIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: build-arm64
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
cd openmp-17.0.2.src
mkdir build-arm64 && cd build-arm64
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=install -D CMAKE_OSX_ARCHITECTURES="arm64" \
-D LIBOMP_ENABLE_SHARED=OFF -D LIBOMP_OMPT_SUPPORT=OFF -D LIBOMP_USE_HWLOC=OFF ..
cmake --build . -j 3
cmake --build . --target install
- name: merge-fat-library
if: steps.cache-openmp.outputs.cache-hit != 'true'
run: |
rm -rf $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install
cp -r openmp-17.0.2.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
lipo -create openmp-17.0.2.src/build-x86_64/install/lib/libomp.a openmp-17.0.2.src/build-arm64/install/lib/libomp.a -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
- name: upload
uses: actions/upload-artifact@v2
with:
name: openmp-macos
path: openmp-install
macos:
needs: [setup, openmp-macos]
runs-on: macos-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-macos
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: download-openmp-macos
uses: actions/download-artifact@v2
with:
name: openmp-macos
path: openmp-macos
- name: install-openmp
run: |
sudo cp openmp-macos/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
sudo cp openmp-macos/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v1
with:
path: "vulkansdk-macos-1.3.261.1"
key: vulkansdk-macos-1.3.261.1
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
wget https://sdk.lunarg.com/sdk/download/1.3.261.1/mac/vulkansdk-macos-1.3.261.1.dmg?Human=true -O vulkansdk-macos-1.3.261.1.dmg
hdiutil attach vulkansdk-macos-1.3.261.1.dmg
sudo /Volumes/vulkansdk-macos-1.3.261.1/InstallVulkan.app/Contents/MacOS/InstallVulkan --root `pwd`/vulkansdk-macos-1.3.261.1 --accept-licenses --default-answer --confirm-command install
sudo rm -rf vulkansdk-macos-1.3.261.1/Applications
find vulkansdk-macos-1.3.261.1 -type f | grep -v -E 'vulkan|glslang|MoltenVK' | xargs rm
hdiutil detach /Volumes/vulkansdk-macos-1.3.261.1
- name: build-x86_64
run: |
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.3.261.1/macOS
mkdir build-x86_64 && cd build-x86_64
cmake -D USE_STATIC_MOLTENVK=ON -D CMAKE_OSX_ARCHITECTURES="x86_64" \
-D OpenMP_C_FLAGS="-Xclang -fopenmp" -D OpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-D OpenMP_C_LIB_NAMES="libomp" -D OpenMP_CXX_LIB_NAMES="libomp" \
-D OpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-D Vulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.3.261.1/MoltenVK/include \
-D Vulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.3.261.1/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
../src
cmake --build . -j 3
- name: build-arm64
run: |
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.3.261.1/macOS
mkdir build-arm64 && cd build-arm64
cmake -D USE_STATIC_MOLTENVK=ON -D CMAKE_OSX_ARCHITECTURES="arm64" \
-D CMAKE_CROSSCOMPILING=ON -D CMAKE_SYSTEM_PROCESSOR=arm64 \
-D OpenMP_C_FLAGS="-Xclang -fopenmp" -D OpenMP_CXX_FLAGS="-Xclang -fopenmp" \
-D OpenMP_C_LIB_NAMES="libomp" -D OpenMP_CXX_LIB_NAMES="libomp" \
-D OpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \
-D Vulkan_INCLUDE_DIR=`pwd`/../vulkansdk-macos-1.3.261.1/MoltenVK/include \
-D Vulkan_LIBRARY=`pwd`/../vulkansdk-macos-1.3.261.1/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \
../src
cmake --build . -j 3
- name: package
# cp -r models/* ${{ env.PACKAGENAME }}
run: |
mkdir -p ${{ env.PACKAGENAME }}
cp README.md LICENSE ${{ env.PACKAGENAME }}
lipo -create build-x86_64/${{ needs.setup.outputs.APPNAME }} build-arm64/${{ needs.setup.outputs.APPNAME }} -o ${{ env.PACKAGENAME }}/${{ needs.setup.outputs.APPNAME }}
strip ${{ env.PACKAGENAME }}/${{ needs.setup.outputs.APPNAME }}
zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
windows:
needs: [setup]
runs-on: windows-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-windows
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: cache-vulkansdk
id: cache-vulkansdk
uses: actions/cache@v1
with:
path: "VulkanSDK"
key: VulkanSDK-1.3.261.1-Installer
- name: vulkansdk
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.3.261.1/windows/VulkanSDK-1.3.261.1-Installer.exe?Human=true -OutFile VulkanSDK-1.3.261.1-Installer.exe
7z x -aoa ./VulkanSDK-1.3.261.1-Installer.exe -oVulkanSDK
- name: build
run: |
$env:VULKAN_SDK="$(pwd)/VulkanSDK"
mkdir build; cd build
cmake -A x64 ../src
cmake --build . --config Release -j 2
- name: package
# Copy-Item -Verbose -Recurse -Path "models\*" -Destination "${{ env.PACKAGENAME }}"
run: |
mkdir ${{ env.PACKAGENAME }}
Copy-Item -Verbose -Path "README.md" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "LICENSE" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "build\Release\${{ needs.setup.outputs.APPNAME }}.exe" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "C:\windows\system32\vcomp140.dll" -Destination "${{ env.PACKAGENAME }}"
Copy-Item -Verbose -Path "C:\windows\system32\vcomp140d.dll" -Destination "${{ env.PACKAGENAME }}"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
release:
needs: [setup, ubuntu, macos, windows]
runs-on: ubuntu-latest
steps:
- name: download
uses: actions/download-artifact@v2
with:
path: artifacts
- name: create-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.VERSION }}
release_name: Release ${{ needs.setup.outputs.VERSION }}
draft: false
prerelease: false
- name: upload-ubuntu
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/${{ env.PACKAGENAME }}/${{ env.PACKAGENAME }}.zip
asset_name: ${{ env.PACKAGENAME }}.zip
asset_content_type: application/zip
- name: upload-macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-macos
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/${{ env.PACKAGENAME }}/${{ env.PACKAGENAME }}.zip
asset_name: ${{ env.PACKAGENAME }}.zip
asset_content_type: application/zip
- name: upload-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-windows
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/${{ env.PACKAGENAME }}/${{ env.PACKAGENAME }}.zip
asset_name: ${{ env.PACKAGENAME }}.zip
asset_content_type: application/zip