Skip to content

ci

ci #575

Workflow file for this run

name: CI
on:
push:
paths:
- "*.pro"
- "package/**"
- "src/**"
- ".github/workflows/ci.yml"
pull_request:
paths:
- "*.pro"
- "package/**"
- "src/**"
- ".github/workflows/ci.yml"
jobs:
create-release:
if: ${{ !startsWith(github.event.ref, 'refs/tags/') }}
name: Create Pre-Release
runs-on: ubuntu-latest
needs:
- build-on-ubuntu
- build-on-win-mingw
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: recursive
- name: Set Env
shell: bash
run: |
export VERSION=$(grep -o '".*"' src/version.h | sed 's/"//g')-build.$GITHUB_RUN_NUMBER
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: etc/usr/artifacts/
- name: Process artifacts
run: |
cd /home/runner/work/modmanager/modmanager/etc/usr/artifacts/ModManager-${{ env.VERSION }}-x64-packed
zip -q -r ModManager-${{ env.VERSION }}-x64-packed.zip *
mv ModManager-${{ env.VERSION }}-x64-packed.zip /home/runner/work/modmanager/modmanager/etc/usr/publish/ModManager-${{ env.VERSION }}-x64-packed.zip
mv /home/runner/work/modmanager/modmanager/etc/usr/artifacts/ModManager-${{ env.VERSION }}-x64-Installer.exe/ModManager-Installer.exe /home/runner/work/modmanager/modmanager/etc/usr/publish/ModManager-${{ env.VERSION }}-x64-Installer.exe
# mv /home/runner/work/modmanager/modmanager/etc/usr/artifacts/ModManager-${{ env.VERSION }}.dmg/modmanager.dmg /home/runner/work/modmanager/modmanager/etc/usr/publish/ModManager-${{ env.VERSION }}.dmg
mv /home/runner/work/modmanager/modmanager/etc/usr/artifacts/ModManager-${{ env.VERSION }}-x86_64.AppImage/Mod_Manager-${{ env.VERSION }}-x86_64.AppImage /home/runner/work/modmanager/modmanager/etc/usr/publish/ModManager-${{ env.VERSION }}.AppImage
- name: Get short commit sha
id: get_short_sha
run: |
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
echo "::set-output name=short_sha::$short_sha"
- name: Create Github release
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.VERSION }}"
prerelease: true
title: "Mod Manager Dev ${{ env.VERSION }} (${{ steps.get_short_sha.outputs.short_sha }})"
files: |
etc/usr/publish/**
build-on-ubuntu:
name: Build On Ubuntu
runs-on: ubuntu-latest # for libaria2-0 available
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 5.15.2
modules: qtwebengine
- name: ubuntu install packages
run: |
sudo apt update
sudo apt-get install -y libglew-dev libglfw3-dev
sudo apt-get install -y libaria2-0-dev libquazip5-dev
sudo apt install -y libgl-dev libx11-dev libxkbcommon-x11-dev libxcb-util1 libxcb-image0-dev libxcb-icccm4-dev libssl-dev libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0
sudo apt install -y libprotobuf-dev protobuf-compiler protobuf-c-compiler libgrpc++-dev protobuf-compiler-grpc ninja-build fcitx-frontend-qt5 libcurl4-openssl-dev
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set Env
run: |
export ARCH=x86_64
export RAW_VERSION=$(grep -o '".*"' src/version.h | sed 's/"//g')
export VERSION=$RAW_VERSION-build.$GITHUB_RUN_NUMBER
export RELEASE_TEXT=$(grep -Pzo "### ${VERSION}\n(\n|.)+?\n##" Changelog.md | sed '$ d')
echo "RAW_VERSION=${RAW_VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "RELEASE_TEXT<<EOF" >> $GITHUB_ENV
echo "${RELEASE_TEXT}" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Modify version number
if: ${{ !startsWith(github.event.ref, 'refs/tags/') }}
shell: bash
run: |
sed -i "s/$RAW_VERSION/$VERSION/" src/version.h
- name: build ubuntu
run: |
qmake
make
- name: package
run: |
make INSTALL_ROOT=AppDir -j2 install ; find AppDir/
wget -c -nv https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) #Thanks to github page change.
chmod +x appimagetool-*.AppImage
sudo mkdir -p /home/qt/work/install
sudo ln -s $QT_PLUGIN_PATH /home/qt/work/install/plugins
./appimagetool-*.AppImage -s deploy AppDir/usr/share/applications/*.desktop
./appimagetool-*.AppImage AppDir
- uses: actions/upload-artifact@v2
with:
name: ModManager-${{ env.VERSION }}-x86_64.AppImage
path: Mod_Manager*.AppImage
- name: uploadRelease
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: Mod_Manager-${{ env.VERSION }}-x86_64.AppImage
asset_name: ModManager-${{ env.VERSION }}-x86_64.AppImage
tag: ${{ github.ref }}
body: ${{ env.RELEASE_TEXT }}
overwrite: true
build-on-win-mingw:
name: Build On Windows Mingw
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
# - qt_arch: win64_mingw
# qt_ver: 6.7.1
# mingw_arch: mingw64
# msys_arch: x86_64
# x64_suffix: -x64
# modules: qt5compat
- qt_arch: win64_mingw81
qt_ver: 5.15.2
qt_tools_mingw_install: mingw810_64
mingw_arch: mingw64
msys_arch: x86_64
x64_suffix: -x64
modules:
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
host: 'windows'
target: 'desktop'
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.modules }}
- uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: recursive
- name: Set Env
shell: bash
run: |
export RAW_VERSION=$(grep -o '".*"' src/version.h | sed 's/"//g')
export VERSION=$RAW_VERSION-build.$GITHUB_RUN_NUMBER
echo "RAW_VERSION=${RAW_VERSION}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Modify version number
if: ${{ !startsWith(github.event.ref, 'refs/tags/') }}
shell: bash
run: |
sed -i "s/$RAW_VERSION/$VERSION/" src/version.h
- name: Install dependencies for Qt 5
if: ${{ startsWith( matrix.qt_ver, 5 ) }}
shell: powershell
run: |
C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-aria2 --noconfirm
C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-quazip-qt5 --noconfirm
- name: Install dependencies for Qt 6
if: ${{ startsWith( matrix.qt_ver, 6 ) }}
shell: powershell
run: |
C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-aria2 --noconfirm
C:/msys64/usr/bin/pacman -S mingw-w64-${{ matrix.msys_arch }}-quazip-qt6 --noconfirm
- name: environment configuration
shell: pwsh
run: |
Write-Output "${{ env.QT_ROOT_DIR }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Output "${{ env.QT_ROOT_DIR }}/../../Tools/${{ matrix.qt_tools_mingw_install }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: where is qmake & where is mingw32-make
shell: pwsh
run: |
Get-Command -Name 'qmake' | Format-List
Get-Command -Name 'mingw32-make' | Format-List
- name: mingw-build
id: build
shell: cmd
run: |
qmake
mingw32-make.exe qmake_all
mingw32-make.exe
- name: list msys dll
shell: pwsh
run : |
ls C:/msys64/${{ matrix.mingw_arch }}/bin
ls ${{ env.QT_ROOT_DIR }}/bin
- name: package
id: package
shell: pwsh
run: |
mkdir deploy
mv release/modmanager.exe deploy
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libcrypto-3${{ matrix.x64_suffix }}.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libbz2-1.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libiconv-2.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/liblzma-5.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libintl-8.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/zlib1.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libstdc++-6.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libsqlite3-0.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libssh2-1.dll deploy/
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libxml2-2.dll deploy/
windeployqt.exe --no-translations --no-opengl-sw --no-system-d3d-compiler --no-quick-import --qmldir "${{ env.QT_ROOT_DIR }}/qml" deploy/modmanager.exe
- name: aria2 dependencies
shell: pwsh
run: |
iwr "https://github.com/kaniol-lck/modmanager/releases/download/v1.1.1-build.543/ModManager-v1.1.1-build.543-x64-packed.zip" -OutFile ModManager-v1.1.1-build.543-x64-packed.zip
unzip *.zip -d old
cp old/libaria2-0.dll deploy/
cp old/libcares-5.dll deploy/
cp old/libcrypto-1_1-x64.dll deploy/
cp old/libssl-1_1-x64.dll deploy/
- name: qt5 dependencies
if: ${{ startsWith( matrix.qt_ver, 5 ) }}
run : |
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libquazip1-qt5.dll deploy/
# - name: qt6 dependencies
# if: ${{ startsWith( matrix.qt_ver, 6 ) }}
# run : |
# cp C:/msys64/${{ matrix.mingw_arch }}/bin/libquazip1-qt6.dll deploy/
# cp C:/msys64/${{ matrix.mingw_arch }}/bin/libicuuc74.dll deploy/
# cp C:/msys64/${{ matrix.mingw_arch }}/bin/libicudt74.dll deploy/
# cp C:/msys64/${{ matrix.mingw_arch }}/bin/Qt6Core5Compat.dll deploy/
- name: x64 dependencies
if: contains(matrix.mingw_arch, 'mingw64')
run : |
cp C:/msys64/${{ matrix.mingw_arch }}/bin/libgcc_s_seh-1.dll deploy/
# - name: x32 dependencies
# if: contains(matrix.mingw_arch, 'mingw32')
# run : |
# cp C:/msys64/${{ matrix.mingw_arch }}/bin/libgcc_s_dw2-1.dll deploy/
- name: Modify NSIS for x64
if: contains(matrix.mingw_arch, 'mingw64')
shell: pwsh
run: |
(Get-Content package/modmanager.nsi).replace('PROGRAMFILES', 'PROGRAMFILES64') | Set-Content package/modmanager.nsi
- name: Create installer
run: |
makensis package/modmanager.nsi
- uses: actions/upload-artifact@v2
with:
name: ModManager-${{ env.VERSION }}${{ matrix.x64_suffix }}-Installer.exe
path: ${{github.workspace}}/package/ModManager*-Installer.exe
- uses: actions/upload-artifact@v2
with:
name: ModManager-${{ env.VERSION }}${{ matrix.x64_suffix }}-packed
path: deploy/*
- name: Upload Release
if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: package/ModManager-Installer.exe
asset_name: ModManager-${{ env.VERSION }}${{ matrix.x64_suffix }}-Installer.exe
tag: ${{ github.ref }}
overwrite: true
# enable them if find a way to build libaria2
#build-on-win-msvc:
#name: Build On Windows MSVC
#runs-on: windows-latest
#strategy:
#matrix:
#include:
#- qt_ver: 5.15.2
#qt_arch: win32_msvc2019
#msvc_arch: x86
#qt_arch_install: msvc2019
#openssl_url: "https://github.com/kaniol-lck/openssl1.1.1-prebuilt/releases/download/1.1.1l/openssl-1.1.1l-win32.zip"
#- qt_ver: 5.15.2
#qt_arch: win64_msvc2019_64
#msvc_arch: x64
#qt_arch_install: msvc2019_64
#openssl_url: "https://github.com/kaniol-lck/openssl1.1.1-prebuilt/releases/download/1.1.1l/openssl-1.1.1l-win64.zip"
#steps:
#- name: Install Qt
#uses: jurplel/install-qt-action@v2.13.0
#with:
#version: ${{ matrix.qt_ver }}
#arch: ${{ matrix.qt_arch }}
#tools: ${{ matrix.qt_tools }}
#cached: "false"
#- uses: actions/checkout@v2
#with:
#fetch-depth: 1
#submodules: recursive
#- name: Install zlib 32
#if: contains(matrix.qt_arch, 'win32_msvc')
#shell: pwsh
#run: |
#set ARCH=Win32
#Invoke-WebRequest -Uri https://git.io/JnHTY -OutFile install_zlib.bat
#./install_zlib.bat
#del install_zlib.bat
#- name: Install zlib
#if: contains(matrix.qt_arch, 'win64_msvc')
#shell: pwsh
#run: |
#Invoke-WebRequest -Uri https://git.io/JnHTY -OutFile install_zlib.bat
#./install_zlib.bat
#del install_zlib.bat
#- name: Test zlib
#shell: cmd
#run: |
#if NOT exist "%PROGRAMFILES%"\zlib\lib\zlib.lib exit 1
#if NOT exist "%PROGRAMFILES%"\zlib\bin\zlib.dll exit 1
#if NOT exist "%PROGRAMFILES%"\zlib\include\zconf.h exit 1
#if NOT exist "%PROGRAMFILES%"\zlib\include\zlib.h exit 1
#if NOT exist "%PROGRAMFILES%"\zlib\lib\zlib.lib exit 1
#- name: Install aria2
#shell: powershell
#run: |
#C:/msys64/usr/bin/pacman -S mingw-w64-x86_64-aria2 --noconfirm
#- name: msvc-build
#id: build
#shell: cmd
#run: |
#call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }}
#qmake
#nmake
#echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV%
#echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
#echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
#echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
#- name: Perpare package
#shell: pwsh
#run: |
#mkdir deploy && mv release/modmanager.exe deploy
#$client = new-object System.Net.WebClient
#$client.DownloadFile('${{ matrix.openssl_url }}', 'openssl-bin.zip')
#Expand-Archive -Path openssl-bin.zip -DestinationPath openssl
#cp openssl/*.dll deploy/
#cp C:/msys64/mingw64/bin/libaria2-0.dll deploy/
#cp LICENSE* deploy/
#cp *md deploy/
#- name: Copy zlib 32
#if: contains(matrix.qt_arch, 'win32_msvc')
#shell: pwsh
#run: |
#cp "C:/Program Files (x86)/zlib/bin/zlib.dll" deploy/
#- name: Copy zlib
#if: contains(matrix.qt_arch, 'win64_msvc')
#shell: pwsh
#run: |
#cp "C:/Program Files/zlib/bin/zlib.dll" deploy/
#- name: package
#id: package
#shell: pwsh
#run: |
#windeployqt.exe --no-translations --no-opengl-sw --no-system-d3d-compiler --no-angle --no-quick-import --qmldir "${{ env.Qt5_DIR }}/qml" deploy/modmanager.exe
#- uses: actions/upload-artifact@v2
#with:
#name: modmanager-${{ matrix.qt_arch }}
#path: ${{github.workspace}}/deploy/
#- name: Create zip
#id: createzip
#shell: pwsh
#run: |
#Compress-Archive -LiteralPath ${{github.workspace}}/deploy -DestinationPath ${{github.workspace}}/modmanager-${{ matrix.qt_arch }}.zip
#- name: Upload Release
#if: startsWith(github.event.ref, 'refs/tags/')
#uses: svenstaro/upload-release-action@v2
#with:
#repo_token: ${{ secrets.GITHUB_TOKEN }}
#file: ${{github.workspace}}/modmanager-${{ matrix.qt_arch }}.zip
#asset_name: modmanager-${{ matrix.qt_arch }}.zip
#tag: ${{ github.ref }}
#overwrite: true
# build-on-osx:
# name: Build On OSX
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [macOS-latest]
# qt_ver: [6.7.1]
# qt_arch: [clang_64]
# steps:
# - name: Install Qt
# uses: jurplel/install-qt-action@v4
# with:
# aqtversion: '==2.1.*'
# version: ${{ matrix.qt_ver }}
# host: 'mac'
# target: 'desktop'
# arch: ${{ matrix.qt_arch }}
# modules: 'qtwebengine'
# - name: Install libaria2
# run: |
# wget "https://github.com/kaniol-lck/aria2/releases/download/libaria2-release-1.36.0/libaria2-clang-macos-10.15.zip"
# unzip *.zip
# csrutil status
# sudo cp -r lib/ usr/local/lib/
# sudo cp -r include/aria2/ usr/local/include/
# rm -rf lib/ include/ *.zip
# - name: Install dependencies
# run: |
# brew install quazip gnu-sed aria2
# - uses: actions/checkout@v2
# with:
# fetch-depth: 1
# - name: Set Env
# shell: bash
# run: |
# export RAW_VERSION=$(grep -o '".*"' src/version.h | sed 's/"//g')
# export VERSION=$RAW_VERSION-build.$GITHUB_RUN_NUMBER
# echo "RAW_VERSION=${RAW_VERSION}" >> $GITHUB_ENV
# echo "VERSION=${VERSION}" >> $GITHUB_ENV
# - name: Modify version number
# if: ${{ !startsWith(github.event.ref, 'refs/tags/') }}
# shell: bash
# run: |
# gsed -i "s/$RAW_VERSION/$VERSION/" src/version.h
# - name: build macos
# run: |
# qmake
# make
# - name: package
# run: |
# macdeployqt modmanager.app -qmldir=. -verbose=1 -dmg
# shell: sh
# - uses: actions/upload-artifact@v2
# with:
# name: ModManager-${{ env.VERSION }}.dmg
# path: modmanager.dmg
# - name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: modmanager.dmg
# asset_name: ModManager-${{ env.VERSION }}.dmg
# tag: ${{ github.ref }}
# overwrite: true