-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ArchieMeng <[email protected]>
- Loading branch information
1 parent
f002ac2
commit 330204f
Showing
1 changed file
with
170 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,7 @@ on: | |
push: | ||
tags: | ||
- "*" | ||
env: | ||
APPLICATION_NAME: waifu2x-ncnn-vulkan-python | ||
APPNAME_SHORT: waifu2x | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
@@ -15,46 +13,93 @@ jobs: | |
steps: | ||
- name: Get app name | ||
id: get_appname | ||
run: echo ::set-output name=APPNAME::${APPLICATION_NAME} | ||
run: echo ::set-output name=APPNAME::${{ github.event.repository.name }} | ||
- name: Get version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
ubuntu: | ||
|
||
create-release: | ||
needs: | ||
- setup | ||
name: Create Relase | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- 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: true | ||
prerelease: false | ||
|
||
windows: | ||
strategy: | ||
matrix: | ||
python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10'] | ||
|
||
needs: [setup, create-release] | ||
|
||
runs-on: windows-latest | ||
env: | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu | ||
DEBIAN_FRONTEND: noninteractive | ||
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.2.162.0-Installer | ||
- name: vulkansdk | ||
if: steps.cache-vulkansdk.outputs.cache-hit != 'true' | ||
run: | | ||
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.2.162.0/windows/VulkanSDK-1.2.162.0-Installer.exe?Human=true -OutFile VulkanSDK-1.2.162.0-Installer.exe | ||
7z x -aoa ./VulkanSDK-1.2.162.0-Installer.exe -oVulkanSDK | ||
Remove-Item .\VulkanSDK\Demos, .\VulkanSDK\Samples, .\VulkanSDK\Third-Party, .\VulkanSDK\Tools, .\VulkanSDK\Tools32, .\VulkanSDK\Bin32, .\VulkanSDK\Lib32 -Recurse | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
- name: Check Python version | ||
run: | | ||
python --version | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3-pip python3-venv libvulkan-dev swig | ||
pip install build | ||
- name: Build | ||
run: | | ||
$env:VULKAN_SDK="$(pwd)\VulkanSDK" | ||
$env:CMAKE_FLAGS="-DPY_VERSION=${{ matrix.python-version }}" | ||
python -m build -w . | ||
- name: Package | ||
run: | | ||
mkdir -p ${{ env.PACKAGENAME }} | ||
cp README.md LICENSE ${{ env.PACKAGENAME }} | ||
cp -r dist/* ${{ env.PACKAGENAME }} | ||
zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }} | ||
mkdir ${{ env.PACKAGENAME }} | ||
Copy-Item -Verbose -Path "README.md" -Destination "${{ env.PACKAGENAME }}" | ||
Copy-Item -Verbose -Path "LICENSE" -Destination "${{ env.PACKAGENAME }}" | ||
Copy-Item -Verbose -Recurse -Path dist\* -Destination "${{ env.PACKAGENAME }}" | ||
7z a -r ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip ${{ env.PACKAGENAME }} | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${{ env.PACKAGENAME }} | ||
path: ${{ env.PACKAGENAME }}.zip | ||
ubuntu-1804: | ||
needs: | ||
- setup | ||
runs-on: ubuntu-18.04 | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_name: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_content_type: application/zip | ||
|
||
ubuntu: | ||
needs: [setup, create-release] | ||
runs-on: ubuntu-latest | ||
env: | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu-1804 | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu | ||
DEBIAN_FRONTEND: noninteractive | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -63,105 +108,144 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3-pip python3-venv libvulkan-dev swig | ||
pip3 install build | ||
sudo apt-get install -y libvulkan-dev glslang-dev glslang-tools | ||
pip install build | ||
- name: Build | ||
run: | | ||
python3 -m build -w . | ||
python -m build -w . | ||
- name: Package | ||
run: | | ||
mkdir -p ${{ env.PACKAGENAME }} | ||
cp README.md LICENSE ${{ env.PACKAGENAME }} | ||
cp -r dist/* ${{ env.PACKAGENAME }} | ||
zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }} | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${{ env.PACKAGENAME }} | ||
path: ${{ env.PACKAGENAME }}.zip | ||
windows: | ||
needs: | ||
- setup | ||
runs-on: windows-latest | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.PACKAGENAME }}.zip | ||
asset_name: ${{ env.PACKAGENAME }}.zip | ||
asset_content_type: application/zip | ||
|
||
ubuntu-1804: | ||
strategy: | ||
matrix: | ||
python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ] | ||
needs: [setup, create-release] | ||
runs-on: ubuntu-18.04 | ||
env: | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-windows | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu1804 | ||
DEBIAN_FRONTEND: noninteractive | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Install Vulkan SDK | ||
uses: humbletim/[email protected] | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
- name: Check Python version | ||
run: | | ||
python --version | ||
- name: cache-vulkansdk | ||
id: cache-vulkansdk | ||
uses: actions/cache@v1 | ||
with: | ||
path: "1.2.162.0" | ||
key: vulkansdk-linux-x86_64-1.2.162.0 | ||
- name: vulkansdk | ||
if: steps.cache-vulkansdk.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://sdk.lunarg.com/sdk/download/1.2.162.0/linux/vulkansdk-linux-x86_64-1.2.162.0.tar.gz?Human=true -O vulkansdk-linux-x86_64-1.2.162.0.tar.gz | ||
tar -xf vulkansdk-linux-x86_64-1.2.162.0.tar.gz | ||
rm -rf 1.2.162.0/source 1.2.162.0/samples | ||
find 1.2.162.0 -type f | grep -v -E 'vulkan|glslang' | xargs rm | ||
- name: Install dependencies | ||
run: | | ||
pip install build | ||
- name: Build | ||
run: | | ||
export VULKAN_SDK=`pwd`/1.2.162.0/x86_64 | ||
export CMAKE_FLAGS="-DPY_VERSION=${{ matrix.python-version }}" | ||
python -m build -w . | ||
- name: Package | ||
run: | | ||
mkdir ${{ env.PACKAGENAME }} | ||
Copy-Item -Verbose -Path "README.md" -Destination "${{ env.PACKAGENAME }}" | ||
Copy-Item -Verbose -Path "LICENSE" -Destination "${{ env.PACKAGENAME }}" | ||
Copy-Item -Verbose -Recurse -Path dist\* -Destination "${{ env.PACKAGENAME }}" | ||
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }} | ||
mkdir -p ${{ env.PACKAGENAME }} | ||
cp README.md LICENSE ${{ env.PACKAGENAME }} | ||
cp -r dist/* ${{ env.PACKAGENAME }} | ||
zip -9 -r ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip ${{ env.PACKAGENAME }} | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.PACKAGENAME }} | ||
path: ${{ env.PACKAGENAME }}.zip | ||
release: | ||
needs: | ||
- setup | ||
- ubuntu | ||
- ubuntu-1804 | ||
- 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: true | ||
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 | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_name: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_content_type: application/zip | ||
- name: Upload (Ubuntu-1804) | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-ubuntu-1804 | ||
|
||
macos: | ||
needs: [setup, create-release] | ||
strategy: | ||
matrix: | ||
python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10'] | ||
env: | ||
PACKAGENAME: ${{ needs.setup.outputs.APPNAME }}-${{ needs.setup.outputs.VERSION }}-macos | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
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) | ||
submodules: recursive | ||
- name: cache-vulkansdk | ||
id: cache-vulkansdk | ||
uses: actions/cache@v1 | ||
with: | ||
path: "vulkansdk-macos-1.2.162.0" | ||
key: vulkansdk-macos-1.2.162.0 | ||
- name: vulkansdk | ||
if: steps.cache-vulkansdk.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://sdk.lunarg.com/sdk/download/1.2.162.0/mac/vulkansdk-macos-1.2.162.0.dmg?Human=true -O vulkansdk-macos-1.2.162.0.dmg | ||
hdiutil attach vulkansdk-macos-1.2.162.0.dmg | ||
cp -r /Volumes/vulkansdk-macos-1.2.162.0 . | ||
rm -rf vulkansdk-macos-1.2.162.0/Applications | ||
find vulkansdk-macos-1.2.162.0 -type f | grep -v -E 'vulkan|glslang|MoltenVK' | xargs rm | ||
hdiutil detach /Volumes/vulkansdk-macos-1.2.162.0 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
- name: Check Python version | ||
run: | | ||
python --version | ||
- name: Install dependencies | ||
run: | | ||
pip install build | ||
- name: Build | ||
run: | | ||
export VULKAN_SDK=`pwd`/vulkansdk-macos-1.2.162.0/macOS | ||
export CMAKE_FLAGS="-DUSE_STATIC_MOLTENVK=ON -DCMAKE_OSX_ARCHITECTURES="x86_64" \ | ||
-DVulkan_INCLUDE_DIR=`pwd`/vulkansdk-macos-1.2.162.0/MoltenVK/include \ | ||
-DVulkan_LIBRARY=`pwd`/vulkansdk-macos-1.2.162.0/MoltenVK/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a \ | ||
-DPY_VERSION=${{ matrix.python-version }}" | ||
python -m build -w . | ||
- name: Package | ||
run: | | ||
mkdir -p ${{ env.PACKAGENAME }} | ||
cp README.md LICENSE ${{ env.PACKAGENAME }} | ||
cp -r dist/* ${{ env.PACKAGENAME }} | ||
zip -9 -r ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip ${{ env.PACKAGENAME }} | ||
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 | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_name: ${{ env.PACKAGENAME }}_${{ matrix.python-version }}.zip | ||
asset_content_type: application/zip |