From 028fc90df6c0357dc8a4695cc14c60eac9d67d29 Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Mon, 11 Sep 2023 07:29:03 +0200 Subject: [PATCH 1/6] Handle saved Windows paths on Unix --- plugins/common/plugin/SfizzFileScan.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/common/plugin/SfizzFileScan.cpp b/plugins/common/plugin/SfizzFileScan.cpp index 66fbe723..aa3d773f 100644 --- a/plugins/common/plugin/SfizzFileScan.cpp +++ b/plugins/common/plugin/SfizzFileScan.cpp @@ -34,7 +34,18 @@ bool SfzFileScan::locateRealFile(const fs::path& pathOrig, fs::path& pathFound) std::unique_lock lock { mutex }; refreshScan(); - auto it = file_index_.find(keyOf(pathOrig.filename())); + const auto key = [&] { + auto path = pathOrig.string(); + if (path.size() > 3 && path[1] == ':' && path[2] == '\\') { + // Assume an absolute windows path and switch anti-slashes to slashes + std::replace(path.begin(), path.end(), '\\', '/'); + return keyOf(fs::path(path).filename()); + } + + return keyOf(pathOrig.filename()); + }(); + + auto it = file_index_.find(key); if (it == file_index_.end()) return false; From 0289bc63beb7ec8a213a171a3eed7b189a9457cd Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Sun, 17 Sep 2023 22:07:32 +0200 Subject: [PATCH 2/6] Properly fill the candidate path drive roots under Windows --- plugins/common/plugin/FileTrie.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/common/plugin/FileTrie.cpp b/plugins/common/plugin/FileTrie.cpp index 014ad626..31c77a04 100644 --- a/plugins/common/plugin/FileTrie.cpp +++ b/plugins/common/plugin/FileTrie.cpp @@ -97,6 +97,10 @@ size_t FileTrieBuilder::ensureDirectory(const fs::path& dirPath) fs::path parentPath = dirPath.parent_path(); if (parentPath != dirPath) ent.parent = ensureDirectory(parentPath); + else + // On Windows, (--dirPath.end()) would be `\\` but `parent_path` and `dirPath` + // would both be `C:\\` so we update the name to match. + ent.name = dirPath.u8string(); } size_t dirIndex = trie.entries_.size(); From e47535d8f76d25bb2360479f1740708e70abf26a Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Mon, 18 Sep 2023 08:34:03 +0200 Subject: [PATCH 3/6] Packages on PR --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65c4efb3..55eda355 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -188,10 +188,10 @@ jobs: sudo killall -9 AudioComponentRegistrar auval -v aumu samp Sfzt - name: Package bundles - if: ${{ github.ref_type == 'tag' }} + # if: ${{ github.ref_type == 'tag' }} run: ./scripts/package-osx-bundles.sh - name: Create installer - if: ${{ github.ref_type == 'tag' }} + # if: ${{ github.ref_type == 'tag' }} working-directory: ${{ github.workspace }}/build run: | options=( @@ -203,7 +203,7 @@ jobs: ) productbuild "${options[@]}" - name: Upload - if: ${{ github.ref_type == 'tag' }} + # if: ${{ github.ref_type == 'tag' }} uses: actions/upload-artifact@v3 with: name: macOS package @@ -267,11 +267,11 @@ jobs: working-directory: ${{ github.workspace }}/build run: pluginval --validate-in-process --validate sfizz.vst3 - name: Create installer - if: ${{ github.ref_type == 'tag' }} + # if: ${{ github.ref_type == 'tag' }} working-directory: ${{ github.workspace }}/build run: iscc /O"." /F"${{ env.install_name }}" /dARCH="${{ matrix.platform }}" innosetup.iss - name: Upload - if: ${{ github.ref_type == 'tag' }} + # if: ${{ github.ref_type == 'tag' }} uses: actions/upload-artifact@v3 with: name: ${{ matrix.pkg_platform }} installer From 6e643ccb64680fe91d2a264012479e32f70c860e Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Wed, 20 Sep 2023 09:01:55 +0200 Subject: [PATCH 4/6] Try windows fix --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55eda355..d0aeacf3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -269,7 +269,11 @@ jobs: - name: Create installer # if: ${{ github.ref_type == 'tag' }} working-directory: ${{ github.workspace }}/build - run: iscc /O"." /F"${{ env.install_name }}" /dARCH="${{ matrix.platform }}" innosetup.iss + env: + install_name: ${{ env.install_name }} + run: | + $stripped_name = $ENV:install_name.replace('/', '-') + iscc /O"." /F"$stripped_name" /dARCH="${{ matrix.platform }}" innosetup.iss - name: Upload # if: ${{ github.ref_type == 'tag' }} uses: actions/upload-artifact@v3 From b6a21fc6ca06615f48f658b02755134b34a51a29 Mon Sep 17 00:00:00 2001 From: redtide Date: Wed, 20 Sep 2023 10:23:55 +0200 Subject: [PATCH 5/6] ci: build artifacts only on PR and tag --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0aeacf3..5c45f0c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -188,10 +188,10 @@ jobs: sudo killall -9 AudioComponentRegistrar auval -v aumu samp Sfzt - name: Package bundles - # if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' || github.event_name == 'pull_request' run: ./scripts/package-osx-bundles.sh - name: Create installer - # if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' || github.event_name == 'pull_request' working-directory: ${{ github.workspace }}/build run: | options=( @@ -203,7 +203,7 @@ jobs: ) productbuild "${options[@]}" - name: Upload - # if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' || github.event_name == 'pull_request' uses: actions/upload-artifact@v3 with: name: macOS package @@ -267,7 +267,7 @@ jobs: working-directory: ${{ github.workspace }}/build run: pluginval --validate-in-process --validate sfizz.vst3 - name: Create installer - # if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' || github.event_name == 'pull_request' working-directory: ${{ github.workspace }}/build env: install_name: ${{ env.install_name }} @@ -275,7 +275,7 @@ jobs: $stripped_name = $ENV:install_name.replace('/', '-') iscc /O"." /F"$stripped_name" /dARCH="${{ matrix.platform }}" innosetup.iss - name: Upload - # if: ${{ github.ref_type == 'tag' }} + if: github.ref_type == 'tag' || github.event_name == 'pull_request' uses: actions/upload-artifact@v3 with: name: ${{ matrix.pkg_platform }} installer From fa0305926c13b047685851985a17f12ac75fac3a Mon Sep 17 00:00:00 2001 From: redtide Date: Wed, 20 Sep 2023 21:45:01 +0200 Subject: [PATCH 6/6] ci: fix macOS and Windows builds when ref name contains a slash --- .github/workflows/build.yml | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c45f0c8..8ec8af5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,16 +129,28 @@ jobs: build_for_macos: name: macOS 11 runs-on: macos-11 - env: - install_name: "sfizz-${{ github.ref_name }}-macos" steps: + - name: Update bash + run: brew install bash + - name: Set install_name + run: | + ghref=${{ github.ref_name }} + echo "install_name=sfizz-${ghref//'/'/'-'}-macos" >> "$GITHUB_ENV" + - name: Show summary + run: | + echo "install_name: ${{ env.install_name }}" + echo "BASH_VERSION: $BASH_VERSION" + system_profiler SPSoftwareDataType + cmake --version + gcc -v + xcodebuild -version + - name: Install dependencies + if: ${{ github.ref_type == 'branch' }} + run: brew install abseil - name: Checkout uses: actions/checkout@v3 with: submodules: recursive - - name: Install dependencies - if: ${{ github.ref_type == 'branch' }} - run: brew install abseil - name: Configure CMake run: | options=( @@ -223,9 +235,14 @@ jobs: pkg_platform: Win64 release_arch: x64 bits: 64 - env: - install_name: sfizz-${{ github.ref_name }}-win${{ matrix.bits }} steps: + - name: Set install name + run: | + $stripped_name="${{ github.ref_name }}".replace('/', '-') + echo "install_name=sfizz-$stripped_name-win${{ matrix.bits }}" >> "${env:GITHUB_ENV}" + - name: Show summary + run: | + echo "install_name: $env:install_name" - name: Checkout uses: actions/checkout@v3 with: @@ -269,11 +286,7 @@ jobs: - name: Create installer if: github.ref_type == 'tag' || github.event_name == 'pull_request' working-directory: ${{ github.workspace }}/build - env: - install_name: ${{ env.install_name }} - run: | - $stripped_name = $ENV:install_name.replace('/', '-') - iscc /O"." /F"$stripped_name" /dARCH="${{ matrix.platform }}" innosetup.iss + run: iscc /O"." /F"${{ env.install_name }}" /dARCH="${{ matrix.platform }}" innosetup.iss - name: Upload if: github.ref_type == 'tag' || github.event_name == 'pull_request' uses: actions/upload-artifact@v3