Skip to content

Commit

Permalink
update workflow and setup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Apr 6, 2024
1 parent 3e8b5e1 commit 407ef3d
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 46 deletions.
57 changes: 32 additions & 25 deletions .github/actions/init-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
where.exe ninja
ninja --version
Write-Output VCPKG_TRIPLET=x64-windows >> $env:GITHUB_ENV
Write-Output VCPKG_TRIPLET_STATIC=x64-windows-static
Write-Output VCPKG_TRIPLET_STATIC=x64-windows-static-md >> $env:GITHUB_ENV
Write-Output QT_ARCH=win64_msvc2019_64 >> $env:GITHUB_ENV
- name: Install build tools (Ubuntu)
Expand All @@ -36,7 +36,7 @@ runs:
Write-Output VCPKG_TRIPLET_STATIC=x64-linux >> $env:GITHUB_ENV
Write-Output QT_ARCH=gcc_64 >> $env:GITHUB_ENV
- name: Install build tools (MacOS)
- name: Install build tools (macOS)
if: inputs.os == 'macos-latest'
shell: pwsh
env:
Expand All @@ -53,51 +53,59 @@ runs:
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
archives: ${{ inputs.os == 'ubuntu-latest' && 'icu qtbase' || 'qtbase' }}
archives: ${{ inputs.os == 'ubuntu-latest' && 'icu qtbase' || 'qtbase' }} qtsvg qtdeclarative qtremoteobjects qttools
cache: true

- name: Restore vcpkg from cache
id: cache_vcpkg
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg
key: ${{ runner.os }}-vcpkg

- name: Clone and bootstrap vcpkg if cache misses
if: steps.cache_vcpkg.outputs.cache-hit != 'true'
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Install vcpkg dependencies
shell: pwsh
run: |
if (!(Test-Path vcpkg)) {
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
${{ inputs.os == 'windows-latest' && './bootstrap-vcpkg.bat' || 'sh ./bootstrap-vcpkg.sh' }}
} else {
cd vcpkg
git pull origin master
}
$env:QT_DIR=$env:Qt5_DIR
$env:VCPKG_KEEP_ENV_VARS="QT_DIR;Qt5_DIR"
./vcpkg install `
--x-manifest-root=${{ github.workspace }}/scripts/vcpkg-manifest `
--x-install-root=./installed `
--triplet=${{ env.VCPKG_TRIPLET }}
./vcpkg install `
--x-manifest-root=${{ github.workspace }}/scripts/setup/diffscope-bridge `
--x-install-root=./installed `
--x-install-root=./bridge_installed `
--triplet=${{ env.VCPKG_TRIPLET_STATIC }}
Remove-Item -Path buildtrees -Recurse -Force
Remove-Item -Path downloads -Recurse -Force
Remove-Item -Path packages -Recurse -Force
if (Test-Path -Path buildtrees) {
Remove-Item -Path buildtrees -Recurse -Force
}
if (Test-Path -Path downloads) {
Remove-Item -Path downloads -Recurse -Force
}
if (Test-Path -Path packages) {
Remove-Item -Path packages -Recurse -Force
}
- name: Save vcpkg to cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg
key: ${{ runner.os }}-vcpkg-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}

- name: Restore ASIO SDK from cache
id: cache_asiosdk
if: inputs.os == 'windows-latest'
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: ${{github.workspace}}/asiosdk
key: asiosdk
Expand All @@ -112,16 +120,15 @@ runs:
- name: Save ASIO SDK to cache
if: inputs.os == 'windows-latest' && steps.cache_asiosdk.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: ${{github.workspace}}/asiosdk
key: asiosdk

- name: Set directory variables
shell: pwsh
run: |
mv vcpkg ..
Write-Output VCPKG_ROOT_DIR=$(Resolve-Path -Path ../vcpkg) >> $env:GITHUB_ENV
Write-Output VCPKG_ROOT_DIR=$(Resolve-Path -Path ./vcpkg) >> $env:GITHUB_ENV
- name: Set ASIO SDK directory variable (Windows)
if: inputs.os == 'windows-latest'
Expand Down
98 changes: 81 additions & 17 deletions .github/workflows/generate-bundles-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
tags:
- "v*"
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:

jobs:
Build:
Expand All @@ -19,6 +22,29 @@ jobs:
with:
submodules: recursive

- name: Get DiffScope Bridge Target
shell: pwsh
run: |
$target = (Get-Content scripts/setup/modules.json | ConvertFrom-Json).'diffscope-bridge'
Write-Output DIFFSCOPE_BRIDGE_REPO=$($target.repository) >> $env:GITHUB_ENV
Write-Output DIFFSCOPE_BRIDGE_REF=$($target.ref) >> $env:GITHUB_ENV
- name: Restore DiffScope Bridge from cache
id: cache_diffscope_bridge
uses: actions/cache/restore@v4
with:
path: scripts/setup/diffscope-bridge
key: ${{ runner.os }}-diffscope-bridge-${{ env.DIFFSCOPE_BRIDGE_REPO }}-${{ env.DIFFSCOPE_BRIDGE_REF }}

- name: Checkout DiffScope Bridge
uses: actions/checkout@v4
if: steps.cache_diffscope_bridge.outputs.cache-hit != 'true'
with:
repository: ${{ env.DIFFSCOPE_BRIDGE_REPO }}
ref: ${{ env.DIFFSCOPE_BRIDGE_REF }}
path: scripts/setup/diffscope-bridge
submodules: recursive

- name: Initialize Building Environment
uses: ./.github/actions/init-build
with:
Expand All @@ -30,26 +56,53 @@ jobs:
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT_DIR }}/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_APPLOCAL_DEPS:BOOL=FALSE `
-DQMSETUP_APPLOCAL_DEPS_PATHS_DEBUG="${{ env.VCPKG_ROOT_DIR }}/installed/${{ env.VCPKG_TRIPLET }}/debug/${{ matrix.os == 'windows-latest' && 'bin' || 'lib' }}" `
-DQMSETUP_APPLOCAL_DEPS_PATHS_RELEASE="${{ env.VCPKG_ROOT_DIR }}/installed/${{ env.VCPKG_TRIPLET }}/${{ matrix.os == 'windows-latest' && 'bin' || 'lib' }}" `
-DCK_ENABLE_CONSOLE:BOOL=FALSE `
-DCK_WIN_APPLOCAL_DEPS:BOOL=TRUE `
-DTALCS_DEVICE_ENABLE_ASIO:BOOL=ON `
-DTALCS_ASIOSDK_DIR=${{ env.ASIOSDK_DIR }} `
-DCMAKE_INSTALL_PREFIX=installed
cmake --build build --target all
cmake --build build --target install
Write-Output DIFFSCOPE_INSTALLED_DIR=$(Resolve-Path -Path build/installed) >> $env:GITHUB_ENV
Write-Output DIFFSCOPE_INSTALLED_DIR=$(Resolve-Path -Path installed) >> $env:GITHUB_ENV
- name: Build DiffScope Bridge
shell: pwsh
if: steps.cache_diffscope_bridge.outputs.cache-hit != 'true'
run: |
cd scripts/setup/diffscope-bridge
cmake -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT_DIR }}/scripts/buildsystems/vcpkg.cmake"
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT_DIR }}/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_INSTALLED_DIR="${{ env.VCPKG_ROOT_DIR }}/bridge_installed" `
-DVCPKG_MANIFEST_MODE:BOOL=OFF `
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET_STATIC }}
cmake --build build --target all
Write-Output DIFFSCOPE_BRIDGE_ARTEFACTS_DIR=$(Resolve-Path -Path build/DiffScopeBridge_artefacts/Release) >> $env:GITHUB_ENV
- name: Store DiffScope Bridge artefacts directory
shell: pwsh
run: |
Write-Output DIFFSCOPE_BRIDGE_ARTEFACTS_DIR=$(Resolve-Path -Path scripts/setup/diffscope-bridge/build/DiffScopeBridge_artefacts/Release) >> $env:GITHUB_ENV
- name: Save DiffScope Bridge to cache
uses: actions/cache/save@v4
with:
path: scripts/setup/diffscope-bridge
key: ${{ runner.os }}-diffscope-bridge-${{ env.DIFFSCOPE_BRIDGE_REPO }}-${{ env.DIFFSCOPE_BRIDGE_REF }}

- name: Set binary name
shell: pwsh
run: |
Write-Output BINARY_NAME=diffscope-$('${{ env.VCPKG_TRIPLET }}'.replace('osx', 'macos'))-${{ github.ref_type == 'tag' && github.ref_name || github.sha }} >> $env:GITHUB_ENV
- name: Create installer (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/jrsoftware/issrc/f59a90485af28067626e60ef7e42336e00ae7472/Files/Languages/Unofficial/ChineseSimplified.isl' -OutFile ChineseSimplified.isl
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/jrsoftware/issrc/e5e138e67bacd650650eac489fa861274a4b81ce/Files/Languages/Unofficial/ChineseTraditional.isl' -OutFile ChineseTraditional.isl
$content = Get-Content build/CMakeCache.txt
$variableValues = @{}
foreach ($line in $content) {
Expand All @@ -61,21 +114,20 @@ jobs:
}
}
Invoke-WebRequest -Uri "https://jrsoftware.org/download.php/is.exe" -OutFile is.exe
Invoke-WebRequest -Uri "https://github.com/WhatTheBlock/innounp/releases/download/v0.50/innounp.exe" -OutFile innounp.exe
mkdir innosetup
./innounp.exe -x -dinnosetup is.exe
$env:SETUP_APP_NAME = $variableValues.CMAKE_PROJECT_NAME
$env:SETUP_APP_VERSION = $variableValues.CMAKE_PROJECT_VERSION
$env:SETUP_APP_INSTALLED_DIR = $env:DIFFSCOPE_INSTALLED_DIR
$env:SETUP_APP_BRIDGE_ARTEFACTS_DIR = $env:DIFFSCOPE_BRIDGE_ARTEFACTS_DIR
Invoke-WebRequest -Uri "https://www.gnu.org/licenses/gpl-3.0.rtf" -OutFile gpl-3.0.rtf
$env:GPL3_LICENSE_PATH = Resolve-Path -Path gpl-3.0.rtf
&'./innosetup/{app}/ISCC.exe' scripts/setup/windows/setup.iss
Write-Output PACKAGE_PATH=$(Resolve-Path -Path scripts/setup/windows/Output/diffscope_setup.exe) >> $env:GITHUB_ENV
cd scripts/setup/windows
ISCC.exe setup.iss
Rename-Item Output/diffscope_setup.exe "$env:BINARY_NAME.exe"
Write-Output PACKAGE_PATH=$(Resolve-Path -Path "Output/$env:BINARY_NAME.exe") >> $env:GITHUB_ENV
- name: Create DMG bundle (MacOS)
- name: Create DMG bundle (macOS)
if: matrix.os == 'macos-latest'
shell: pwsh
run: |
cd scripts/setup/macos
Expand All @@ -87,12 +139,24 @@ jobs:
ln -s $env:DIFFSCOPE_BRIDGE_ARTEFACTS_DIR diffscope-bridge-artefacts
packagesbuild diffscope-bridge-dist.pkgproj
npm install
node create-dmg.js $env:DIFFSCOPE_INSTALLED_DIR/DiffScope.app 'DiffScope Bridge.pkg' DiffScope.dmg
Write-Output PACKAGE_PATH=$(Resolve-Path -Path DiffScope.dmg) >> $env:GITHUB_ENV
node create-dmg.js $env:DIFFSCOPE_INSTALLED_DIR/DiffScope.app 'DiffScope Bridge.pkg' "$env:BINARY_NAME.dmg"
Write-Output PACKAGE_PATH=$(Resolve-Path -Path "$env:BINARY_NAME.dmg") >> $env:GITHUB_ENV
- name: Upload release file
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: diffscope-${{ env.VCPKG_TRIPLET }}-${{ github.ref }}
name: ${{ env.BINARY_NAME }}
path: ${{ env.PACKAGE_PATH }}

Release:
runs-on: ubuntu-latest
needs: Build
if: github.event_name == 'push'
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
diffscope-*/*
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@
[submodule "jetbrains-docking-system"]
path = libs/jetbrains-docking-system
url = ../../stdware/jetbrains-docking-system.git
[submodule "scripts/setup/diffscope-bridge"]
path = scripts/setup/diffscope-bridge
url = [email protected]:CrSjimo/diffscope-bridge.git
1 change: 0 additions & 1 deletion scripts/setup/diffscope-bridge
Submodule diffscope-bridge deleted from 2cf574
6 changes: 6 additions & 0 deletions scripts/setup/modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"diffscope-bridge": {
"repository": "CrSjimo/diffscope-bridge",
"ref": "941f82380a833bc6aa04f57328b77e46d7caf5c9"
}
}
3 changes: 3 additions & 0 deletions scripts/setup/windows/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DefaultDirName={autopf}\OpenVPI\{#MyAppName}
ChangesAssociations=yes
DisableProgramGroupPage=yes
LicenseFile={#MyAppInstalledDir}\share\doc\DiffScope\license-en.txt
InfoBeforeFile={#GetEnv("GPL3_LICENSE_PATH")}
OutputBaseFilename=diffscope_setup
Compression=lzma
SolidCompression=yes
Expand All @@ -37,6 +38,8 @@ ArchitecturesInstallIn64BitMode=x64

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimplified"; MessagesFile: "{#GetEnv('GITHUB_WORKSPACE')}\ChineseSimplified.isl"
Name: "chinesetraditional"; MessagesFile: "{#GetEnv('GITHUB_WORKSPACE')}\ChineseTraditional.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"

[Tasks]
Expand Down

0 comments on commit 407ef3d

Please sign in to comment.