From cf719279979a6f49eafce32bc156181169efa2ce Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Mon, 22 Mar 2021 17:43:59 +0100 Subject: [PATCH 01/26] First attempt at building iOS wrappers --- .github/workflows/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5dfe508eb8..72fbd3a04c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,5 +17,20 @@ jobs: with: cmds: | ./wrappers/build-macos.sh + cachePaths: | + ./wrappers + build-wrappers-ios: + runs-on: macos-latest + name: Build iOS wrappers + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Build wrappers + uses: ./.github/actions/build_cache_executor + with: + cmds: | + ./wrappers/build-ios.sh --configuration=Release cachePaths: | ./wrappers \ No newline at end of file From d9aaff2c81419e11df306316e47b8045cfbafc69 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 23 Mar 2021 12:19:52 +0100 Subject: [PATCH 02/26] Added hash prefix as the macos and ios resulted with the same default hash key --- .github/workflows/main.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72fbd3a04c..339cfd0536 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,7 @@ jobs: ./wrappers/build-macos.sh cachePaths: | ./wrappers + hashPrefix: cache-macos- build-wrappers-ios: runs-on: macos-latest name: Build iOS wrappers @@ -33,4 +34,34 @@ jobs: cmds: | ./wrappers/build-ios.sh --configuration=Release cachePaths: | - ./wrappers \ No newline at end of file + ./wrappers + hashPrefix: cache-ios- + # build-wrappers-windows: + # runs-on: windows-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # submodules: 'recursive' + # - name: Get CMake + # # If there is a cache hit, no need to do any of the following steps. Unfortunately there is no way to cancel the rest of the job. + # if: steps.wrapper-cache.outputs.cache-hit != 'true' + # uses: lukka/get-cmake@latest + # - name: Restore from cache and run vcpkg + # if: steps.wrapper-cache.outputs.cache-hit != 'true' + # uses: lukka/run-vcpkg@v5 + # with: + # # Contains the list of packages and the triplet. If we need more than one triplet, we need to pass it with command line arguments + # vcpkgArguments: '@${{ env.vcpkgResponseFile }}' + # vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 + # # If the cache key is the same, it does not execute + # appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} + # env: + # vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' + # - name: Build wrappers + # uses: ./.github/actions/build_cache_executor + # with: + # cmds: | + # .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" + # cachePaths: | + # .\wrappers \ No newline at end of file From 244632297c7bbc7faa7bcdf3cbe83e5eba28d581 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 23 Mar 2021 13:33:38 +0100 Subject: [PATCH 03/26] Test bulding windows wrappers --- .github/workflows/main.yml | 53 +++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 339cfd0536..b536081843 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,32 +36,27 @@ jobs: cachePaths: | ./wrappers hashPrefix: cache-ios- - # build-wrappers-windows: - # runs-on: windows-latest - # steps: - # - name: Checkout code - # uses: actions/checkout@v2 - # with: - # submodules: 'recursive' - # - name: Get CMake - # # If there is a cache hit, no need to do any of the following steps. Unfortunately there is no way to cancel the rest of the job. - # if: steps.wrapper-cache.outputs.cache-hit != 'true' - # uses: lukka/get-cmake@latest - # - name: Restore from cache and run vcpkg - # if: steps.wrapper-cache.outputs.cache-hit != 'true' - # uses: lukka/run-vcpkg@v5 - # with: - # # Contains the list of packages and the triplet. If we need more than one triplet, we need to pass it with command line arguments - # vcpkgArguments: '@${{ env.vcpkgResponseFile }}' - # vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 - # # If the cache key is the same, it does not execute - # appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} - # env: - # vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' - # - name: Build wrappers - # uses: ./.github/actions/build_cache_executor - # with: - # cmds: | - # .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" - # cachePaths: | - # .\wrappers \ No newline at end of file + build-wrappers-windows: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Get CMake + uses: lukka/get-cmake@latest + - name: Restore from cache and run vcpkg + uses: lukka/run-vcpkg@v5 + with: + vcpkgArguments: '@${{ env.vcpkgResponseFile }}' + vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 + appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} + env: + vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' + - name: Build wrappers + uses: ./.github/actions/build_cache_executor + with: + cmds: | + .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" + cachePaths: | + .\wrappers \ No newline at end of file From c1278f74faa9283ec619f1fb1e1728458cb9d5f4 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 23 Mar 2021 14:26:08 +0100 Subject: [PATCH 04/26] Minor changes --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b536081843..7cf5d62fc1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,7 @@ jobs: hashPrefix: cache-ios- build-wrappers-windows: runs-on: windows-latest + name: Build Windows wrappers steps: - name: Checkout code uses: actions/checkout@v2 @@ -54,9 +55,10 @@ jobs: env: vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' - name: Build wrappers - uses: ./.github/actions/build_cache_executor + uses: .\.github\actions\build_cache_executor with: cmds: | .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" cachePaths: | - .\wrappers \ No newline at end of file + .\wrappers + hashPrefix: cache-win- \ No newline at end of file From 88dfccd88d7043a75b4db217e8974d056208cbbf Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 24 Mar 2021 12:13:57 +0100 Subject: [PATCH 05/26] Test to see if some steps mess up with the win repo --- .github/workflows/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7cf5d62fc1..1d68b3b256 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,16 +44,16 @@ jobs: uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Get CMake - uses: lukka/get-cmake@latest - - name: Restore from cache and run vcpkg - uses: lukka/run-vcpkg@v5 - with: - vcpkgArguments: '@${{ env.vcpkgResponseFile }}' - vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 - appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} - env: - vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' + # - name: Get CMake + # uses: lukka/get-cmake@latest + # - name: Restore from cache and run vcpkg + # uses: lukka/run-vcpkg@v5 + # with: + # vcpkgArguments: '@${{ env.vcpkgResponseFile }}' + # vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 + # appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} + # env: + # vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From 3ddd0ba6d73e7957ce217926cc4c3b32c0da107d Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 24 Mar 2021 15:52:52 +0100 Subject: [PATCH 06/26] Updated build-ios.sh to fix relative path --- wrappers/build-ios.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wrappers/build-ios.sh b/wrappers/build-ios.sh index be946309a6..d35432f4a4 100755 --- a/wrappers/build-ios.sh +++ b/wrappers/build-ios.sh @@ -30,10 +30,10 @@ function build() { # This is a workaround for CMAKE_IOS_INSTALL_COMBINED removing @rpath from LC_DYLIB_ID. # Reported here: https://cmake.org/pipermail/cmake/2018-October/068316.html - rm build/iOS/$REALM_CMAKE_CONFIGURATION/realm-wrappers.framework/realm-wrappers - xcrun lipo -create cmake/iOS/src/$REALM_CMAKE_CONFIGURATION-iphoneos/realm-wrappers.framework/realm-wrappers \ - cmake/iOS/src/$REALM_CMAKE_CONFIGURATION-iphonesimulator/realm-wrappers.framework/realm-wrappers \ - -output build/iOS/$REALM_CMAKE_CONFIGURATION/realm-wrappers.framework/realm-wrappers + rm "$SCRIPT_DIRECTORY"/build/iOS/$REALM_CMAKE_CONFIGURATION/realm-wrappers.framework/realm-wrappers + xcrun lipo -create "$SCRIPT_DIRECTORY"/cmake/iOS/src/$REALM_CMAKE_CONFIGURATION-iphoneos/realm-wrappers.framework/realm-wrappers \ + "$SCRIPT_DIRECTORY"/cmake/iOS/src/$REALM_CMAKE_CONFIGURATION-iphonesimulator/realm-wrappers.framework/realm-wrappers \ + -output "$SCRIPT_DIRECTORY"/build/iOS/$REALM_CMAKE_CONFIGURATION/realm-wrappers.framework/realm-wrappers } build \ No newline at end of file From 9b83bcf31a593b8faa194f5d84d55ec60a20b93d Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 24 Mar 2021 16:20:26 +0100 Subject: [PATCH 07/26] Hopefully build windows --- .github/actions/get-vcpkg-prebuilt/action.yml | 9 +++++++++ .github/workflows/main.yml | 13 ++----------- 2 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 .github/actions/get-vcpkg-prebuilt/action.yml diff --git a/.github/actions/get-vcpkg-prebuilt/action.yml b/.github/actions/get-vcpkg-prebuilt/action.yml new file mode 100644 index 0000000000..ada068ba7a --- /dev/null +++ b/.github/actions/get-vcpkg-prebuilt/action.yml @@ -0,0 +1,9 @@ +name: 'get-vcpkg-prebuilt' +description: 'Get windows build dependencies' +runs: + using: "composite" + steps: + - run: | + Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip + Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\ + shell: powershell \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d68b3b256..224887f96a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,21 +44,12 @@ jobs: uses: actions/checkout@v2 with: submodules: 'recursive' - # - name: Get CMake - # uses: lukka/get-cmake@latest - # - name: Restore from cache and run vcpkg - # uses: lukka/run-vcpkg@v5 - # with: - # vcpkgArguments: '@${{ env.vcpkgResponseFile }}' - # vcpkgGitCommitId: ec6fe06e8da05a8157dc8581fa96b36b571c1bd5 - # appendedCacheKey: ${{ hashFiles(env.vcpkgResponseFile) }} - # env: - # vcpkgResponseFile: '${{ github.workspace }}\.github\workflows\response_file.txt' + - uses: ./.github/actions/get-vcpkg-prebuilt - name: Build wrappers uses: .\.github\actions\build_cache_executor with: cmds: | - .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 -Toolchain "${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" + .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 cachePaths: | .\wrappers hashPrefix: cache-win- \ No newline at end of file From 4c80d48b7e6a59baa6d2c33c0e4ddbdb8fa96937 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 24 Mar 2021 16:25:21 +0100 Subject: [PATCH 08/26] Fixed win for powershell --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 224887f96a..607c91f27c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,7 +49,7 @@ jobs: uses: .\.github\actions\build_cache_executor with: cmds: | - .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 + powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 cachePaths: | .\wrappers hashPrefix: cache-win- \ No newline at end of file From e5443e1d5cf7f194fb7cdc58806612fd0e9cfe1b Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 11:29:59 +0200 Subject: [PATCH 09/26] Fixed input name in workflow --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7a26aab27..b0b4a44609 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,8 +28,8 @@ jobs: - name: Build wrappers uses: ./.github/actions/build_cache_executor with: - cmds: ./wrappers/build-ios.sh --configuration=Release - cachePaths: ./wrappers + cmd: ./wrappers/build-ios.sh --configuration=Release + cachePath: ./wrappers build-wrappers-windows: runs-on: windows-latest name: Build Windows wrappers @@ -42,5 +42,5 @@ jobs: - name: Build wrappers uses: .\.github\actions\build_cache_executor with: - cmds: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 - cachePaths: .\wrappers + cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 + cachePath: .\wrappers From 1bbc8b4bbba8123a48e01add9e5f7e6026eee4ff Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 11:56:56 +0200 Subject: [PATCH 10/26] Cache win dependences --- .github/workflows/main.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b0b4a44609..6e9e11ec82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,8 +37,12 @@ jobs: - name: Checkout code uses: actions/checkout@v2 with: - submodules: "recursive" - - uses: ./.github/actions/get-vcpkg-prebuilt + submodules: recursive + - name: Fetch dependencies + uses: .\.github\actions\build_cache_executor + with: + cmd: Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip && Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\ + cachePath: 'C:\' - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From f419ade2ce659cc58c7211ec3c366900f06c67a0 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 12:04:25 +0200 Subject: [PATCH 11/26] Cache win dependences - path no more C --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e9e11ec82..dd21ca19f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: uses: .\.github\actions\build_cache_executor with: cmd: Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip && Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\ - cachePath: 'C:\' + cachePath: ./wrappers/build.ps1 - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From f00a2c96821a59dee22b05646837fb86b289e650 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 12:08:43 +0200 Subject: [PATCH 12/26] Cache win dependences - more fix --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd21ca19f5..936a8968b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: - name: Fetch dependencies uses: .\.github\actions\build_cache_executor with: - cmd: Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip && Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\ + cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) cachePath: ./wrappers/build.ps1 - name: Build wrappers uses: .\.github\actions\build_cache_executor From e61dd5ed1f70c3104e27054279ffa1455bea6a13 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 14:46:39 +0200 Subject: [PATCH 13/26] Matrix arch on win --- .github/workflows/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 936a8968b3..fe0f70472e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,7 @@ jobs: with: cmd: ./wrappers/build-macos.sh cachePath: ./wrappers + build-wrappers-ios: runs-on: macos-latest name: Build iOS wrappers @@ -30,9 +31,13 @@ jobs: with: cmd: ./wrappers/build-ios.sh --configuration=Release cachePath: ./wrappers + build-wrappers-windows: runs-on: windows-latest name: Build Windows wrappers + strategy: + matrix: + arch: [Win32, x64] steps: - name: Checkout code uses: actions/checkout@v2 @@ -46,5 +51,5 @@ jobs: - name: Build wrappers uses: .\.github\actions\build_cache_executor with: - cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms x64 + cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} cachePath: .\wrappers From 1e188234e9858353eb6e4c742b09782857ea9522 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 17:57:48 +0200 Subject: [PATCH 14/26] Input parsing again to check skip path --- .../actions/build_cache_executor/action.yml | 4 +-- .../build_cache_executor/dist/index.js | 35 ++++++++++++++----- .../actions/build_cache_executor/src/main.ts | 2 +- .../dist/build_cache_executor.d.ts | 4 +-- .../dist/build_cache_executor.js | 16 +++++---- .../dist/input_parsing.d.ts | 1 + .../dist/input_parsing.js | 10 ++++++ .../src/build_cache_executor.ts | 16 +++++---- .../build_cache_executor/src/input_parsing.ts | 5 +++ .github/workflows/main.yml | 12 ++++--- 10 files changed, 74 insertions(+), 31 deletions(-) create mode 100644 .github/ga_packages/build_cache_executor/dist/input_parsing.d.ts create mode 100644 .github/ga_packages/build_cache_executor/dist/input_parsing.js create mode 100644 .github/ga_packages/build_cache_executor/src/input_parsing.ts diff --git a/.github/actions/build_cache_executor/action.yml b/.github/actions/build_cache_executor/action.yml index a6aaa34c51..d54528222d 100644 --- a/.github/actions/build_cache_executor/action.yml +++ b/.github/actions/build_cache_executor/action.yml @@ -4,8 +4,8 @@ inputs: cmd: description: Command that needs to be executed to produce the build required: true - cachePath: - description: Path that the action is going to use to produce an index to look up cached artifacts or to save them if none were found + cachePaths: + description: New line separated paths that the action is going to use to produce an index to look up cached artifacts or to save them if none were found required: true outputs: hashKey: diff --git a/.github/actions/build_cache_executor/dist/index.js b/.github/actions/build_cache_executor/dist/index.js index 7f82f9cf46..72e4a08b6b 100644 --- a/.github/actions/build_cache_executor/dist/index.js +++ b/.github/actions/build_cache_executor/dist/index.js @@ -41,8 +41,8 @@ const actionCore = __importStar(__nccwpck_require__(9301)); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const path = core.getInput("cachePath", { required: true }); const cmd = core.getInput("cmd", { required: true }); + const path = core.getInput("cachePaths", { required: true }); const cacheKey = yield actionCore.actionCore(path, cmd, core); if (cacheKey === undefined) { core.setFailed(`Action aborted because either artifacts could not be built or they could not be cached`); @@ -493,34 +493,36 @@ const cache = __importStar(__nccwpck_require__(4471)); const exec = __importStar(__nccwpck_require__(3864)); const folderHash = __importStar(__nccwpck_require__(63)); const fs = __importStar(__nccwpck_require__(6344)); +const input_parsing = __importStar(__nccwpck_require__(3856)); /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param path Path that needs to be cached after the build (same paths used to create a hash) + * @param paths Paths that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -function actionCore(path, cmd, logger) { +function actionCore(paths, cmd, logger) { return __awaiter(this, void 0, void 0, function* () { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (path.length === 0) { + if (paths.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } + const parsedPaths = input_parsing.parse_paths(paths); let hashKey; try { - hashKey = cmd.concat(yield getHash(path)); + hashKey = cmd.concat(yield getHash(parsedPaths[0])); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${path} is: ${hashKey}`); + logger.info(`Hash key for ${paths} is: ${hashKey}`); try { - cacheHit = yield cache.restoreCache([path], hashKey); + cacheHit = yield cache.restoreCache(parsedPaths, hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); @@ -542,7 +544,7 @@ function actionCore(path, cmd, logger) { } if (hashKey !== undefined) { try { - const cacheId = yield cache.saveCache([path], hashKey); + const cacheId = yield cache.saveCache(parsedPaths, hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { @@ -595,6 +597,23 @@ exports.getHash = getHash; /***/ }), +/***/ 3856: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parse_paths = void 0; +/** @internal */ +function parse_paths(paths) { + // filter avoids empty elements + return paths.split("\n").filter((i) => i); +} +exports.parse_paths = parse_paths; +//# sourceMappingURL=input_parsing.js.map + +/***/ }), + /***/ 4471: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { diff --git a/.github/actions/build_cache_executor/src/main.ts b/.github/actions/build_cache_executor/src/main.ts index 48429c3bb8..2bcac891b1 100644 --- a/.github/actions/build_cache_executor/src/main.ts +++ b/.github/actions/build_cache_executor/src/main.ts @@ -3,8 +3,8 @@ import * as actionCore from "../../../ga_packages/build_cache_executor/dist/buil async function run(): Promise { try { - const path = core.getInput("cachePath", { required: true }); const cmd = core.getInput("cmd", { required: true }); + const path = core.getInput("cachePaths", { required: true }); const cacheKey = await actionCore.actionCore(path, cmd, core); diff --git a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts index f0057aec98..baf6ac75ff 100644 --- a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts +++ b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts @@ -1,12 +1,12 @@ /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param path Path that needs to be cached after the build (same paths used to create a hash) + * @param paths Paths that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -export declare function actionCore(path: string, cmd: string, logger: iLogger): Promise; +export declare function actionCore(paths: string, cmd: string, logger: iLogger): Promise; export interface iLogger { debug(message: string): void; info(message: string): void; diff --git a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js index cdfd66716e..9c522b4f72 100644 --- a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js +++ b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js @@ -33,34 +33,36 @@ const cache = __importStar(require("@actions/cache")); const exec = __importStar(require("@actions/exec")); const folderHash = __importStar(require("folder-hash")); const fs = __importStar(require("fs-extra")); +const input_parsing = __importStar(require("./input_parsing")); /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param path Path that needs to be cached after the build (same paths used to create a hash) + * @param paths Paths that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -function actionCore(path, cmd, logger) { +function actionCore(paths, cmd, logger) { return __awaiter(this, void 0, void 0, function* () { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (path.length === 0) { + if (paths.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } + const parsedPaths = input_parsing.parse_paths(paths); let hashKey; try { - hashKey = cmd.concat(yield getHash(path)); + hashKey = cmd.concat(yield getHash(parsedPaths[0])); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${path} is: ${hashKey}`); + logger.info(`Hash key for ${paths} is: ${hashKey}`); try { - cacheHit = yield cache.restoreCache([path], hashKey); + cacheHit = yield cache.restoreCache(parsedPaths, hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); @@ -82,7 +84,7 @@ function actionCore(path, cmd, logger) { } if (hashKey !== undefined) { try { - const cacheId = yield cache.saveCache([path], hashKey); + const cacheId = yield cache.saveCache(parsedPaths, hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { diff --git a/.github/ga_packages/build_cache_executor/dist/input_parsing.d.ts b/.github/ga_packages/build_cache_executor/dist/input_parsing.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/.github/ga_packages/build_cache_executor/dist/input_parsing.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/.github/ga_packages/build_cache_executor/dist/input_parsing.js b/.github/ga_packages/build_cache_executor/dist/input_parsing.js new file mode 100644 index 0000000000..cf19305501 --- /dev/null +++ b/.github/ga_packages/build_cache_executor/dist/input_parsing.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parse_paths = void 0; +/** @internal */ +function parse_paths(paths) { + // filter avoids empty elements + return paths.split("\n").filter((i) => i); +} +exports.parse_paths = parse_paths; +//# sourceMappingURL=input_parsing.js.map \ No newline at end of file diff --git a/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts b/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts index fe7a8dc0e9..768cec5668 100644 --- a/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts +++ b/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts @@ -2,35 +2,37 @@ import * as cache from "@actions/cache"; import * as exec from "@actions/exec"; import * as folderHash from "folder-hash"; import * as fs from "fs-extra"; +import * as input_parsing from "./input_parsing"; /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param path Path that needs to be cached after the build (same paths used to create a hash) + * @param paths Paths that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -export async function actionCore(path: string, cmd: string, logger: iLogger): Promise { +export async function actionCore(paths: string, cmd: string, logger: iLogger): Promise { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (path.length === 0) { + if (paths.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } + const parsedPaths = input_parsing.parse_paths(paths); let hashKey: string | undefined; try { - hashKey = cmd.concat(await getHash(path)); + hashKey = cmd.concat(await getHash(parsedPaths[0])); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit: string | undefined = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${path} is: ${hashKey}`); + logger.info(`Hash key for ${paths} is: ${hashKey}`); try { - cacheHit = await cache.restoreCache([path], hashKey); + cacheHit = await cache.restoreCache(parsedPaths, hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); } @@ -54,7 +56,7 @@ export async function actionCore(path: string, cmd: string, logger: iLogger): Pr if (hashKey !== undefined) { try { - const cacheId = await cache.saveCache([path], hashKey); + const cacheId = await cache.saveCache(parsedPaths, hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { throw new Error(`The cache could not be saved: ${error.message}`); diff --git a/.github/ga_packages/build_cache_executor/src/input_parsing.ts b/.github/ga_packages/build_cache_executor/src/input_parsing.ts new file mode 100644 index 0000000000..c4a651a533 --- /dev/null +++ b/.github/ga_packages/build_cache_executor/src/input_parsing.ts @@ -0,0 +1,5 @@ +/** @internal */ +export function parse_paths(paths: string): string[] { + // filter avoids empty elements + return paths.split("\n").filter((i) => i); +} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe0f70472e..50990b4898 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: REALM_CMAKE_CONFIGURATION: Release with: cmd: ./wrappers/build-macos.sh - cachePath: ./wrappers + cachePaths: ./wrappers build-wrappers-ios: runs-on: macos-latest @@ -30,7 +30,7 @@ jobs: uses: ./.github/actions/build_cache_executor with: cmd: ./wrappers/build-ios.sh --configuration=Release - cachePath: ./wrappers + cachePaths: ./wrappers build-wrappers-windows: runs-on: windows-latest @@ -44,12 +44,16 @@ jobs: with: submodules: recursive - name: Fetch dependencies + # uses: .\.github\actions\get-vcpkg-prebuilt uses: .\.github\actions\build_cache_executor with: cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) - cachePath: ./wrappers/build.ps1 + cachePaths: | + 'C:\' + '!C:\System Volume Information' - name: Build wrappers uses: .\.github\actions\build_cache_executor with: cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} - cachePath: .\wrappers + # cachePaths: .\wa!ppers +# From 1318e3bfc867573552a072630aae04334680dc22 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 18:14:56 +0200 Subject: [PATCH 15/26] Confused by string interpretation --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50990b4898..d8c7f516eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,7 +49,7 @@ jobs: with: cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) cachePaths: | - 'C:\' + 'C:' '!C:\System Volume Information' - name: Build wrappers uses: .\.github\actions\build_cache_executor From 2d1736de545ae0b57831641928f85e1416391dab Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 18:16:35 +0200 Subject: [PATCH 16/26] Confused by string interpretation - again --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d8c7f516eb..2726ff2b36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,8 +49,8 @@ jobs: with: cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) cachePaths: | - 'C:' - '!C:\System Volume Information' + C:\ + !C:\System Volume Information - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From c541fb1c3a6a7a23ceee77ec7a8ea0d5862acaa1 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 30 Mar 2021 18:25:56 +0200 Subject: [PATCH 17/26] Reverte all, no cache for win deps --- .../actions/build_cache_executor/action.yml | 4 +-- .../build_cache_executor/dist/index.js | 35 +++++-------------- .../actions/build_cache_executor/src/main.ts | 2 +- .../dist/build_cache_executor.d.ts | 4 +-- .../dist/build_cache_executor.js | 16 ++++----- .../src/build_cache_executor.ts | 16 ++++----- .../build_cache_executor/src/input_parsing.ts | 5 --- .github/workflows/main.yml | 21 ++++++----- 8 files changed, 37 insertions(+), 66 deletions(-) delete mode 100644 .github/ga_packages/build_cache_executor/src/input_parsing.ts diff --git a/.github/actions/build_cache_executor/action.yml b/.github/actions/build_cache_executor/action.yml index d54528222d..a6aaa34c51 100644 --- a/.github/actions/build_cache_executor/action.yml +++ b/.github/actions/build_cache_executor/action.yml @@ -4,8 +4,8 @@ inputs: cmd: description: Command that needs to be executed to produce the build required: true - cachePaths: - description: New line separated paths that the action is going to use to produce an index to look up cached artifacts or to save them if none were found + cachePath: + description: Path that the action is going to use to produce an index to look up cached artifacts or to save them if none were found required: true outputs: hashKey: diff --git a/.github/actions/build_cache_executor/dist/index.js b/.github/actions/build_cache_executor/dist/index.js index 72e4a08b6b..1d86cd1960 100644 --- a/.github/actions/build_cache_executor/dist/index.js +++ b/.github/actions/build_cache_executor/dist/index.js @@ -42,7 +42,7 @@ function run() { return __awaiter(this, void 0, void 0, function* () { try { const cmd = core.getInput("cmd", { required: true }); - const path = core.getInput("cachePaths", { required: true }); + const path = core.getInput("cachePath", { required: true }); const cacheKey = yield actionCore.actionCore(path, cmd, core); if (cacheKey === undefined) { core.setFailed(`Action aborted because either artifacts could not be built or they could not be cached`); @@ -493,36 +493,34 @@ const cache = __importStar(__nccwpck_require__(4471)); const exec = __importStar(__nccwpck_require__(3864)); const folderHash = __importStar(__nccwpck_require__(63)); const fs = __importStar(__nccwpck_require__(6344)); -const input_parsing = __importStar(__nccwpck_require__(3856)); /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param paths Paths that needs to be cached after the build (same paths used to create a hash) + * @param path Path that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -function actionCore(paths, cmd, logger) { +function actionCore(path, cmd, logger) { return __awaiter(this, void 0, void 0, function* () { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (paths.length === 0) { + if (path.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } - const parsedPaths = input_parsing.parse_paths(paths); let hashKey; try { - hashKey = cmd.concat(yield getHash(parsedPaths[0])); + hashKey = cmd.concat(yield getHash(path)); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${paths} is: ${hashKey}`); + logger.info(`Hash key for ${path} is: ${hashKey}`); try { - cacheHit = yield cache.restoreCache(parsedPaths, hashKey); + cacheHit = yield cache.restoreCache([path], hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); @@ -544,7 +542,7 @@ function actionCore(paths, cmd, logger) { } if (hashKey !== undefined) { try { - const cacheId = yield cache.saveCache(parsedPaths, hashKey); + const cacheId = yield cache.saveCache([path], hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { @@ -597,23 +595,6 @@ exports.getHash = getHash; /***/ }), -/***/ 3856: -/***/ ((__unused_webpack_module, exports) => { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.parse_paths = void 0; -/** @internal */ -function parse_paths(paths) { - // filter avoids empty elements - return paths.split("\n").filter((i) => i); -} -exports.parse_paths = parse_paths; -//# sourceMappingURL=input_parsing.js.map - -/***/ }), - /***/ 4471: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { diff --git a/.github/actions/build_cache_executor/src/main.ts b/.github/actions/build_cache_executor/src/main.ts index 2bcac891b1..4c7664923a 100644 --- a/.github/actions/build_cache_executor/src/main.ts +++ b/.github/actions/build_cache_executor/src/main.ts @@ -4,7 +4,7 @@ import * as actionCore from "../../../ga_packages/build_cache_executor/dist/buil async function run(): Promise { try { const cmd = core.getInput("cmd", { required: true }); - const path = core.getInput("cachePaths", { required: true }); + const path = core.getInput("cachePath", { required: true }); const cacheKey = await actionCore.actionCore(path, cmd, core); diff --git a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts index baf6ac75ff..f0057aec98 100644 --- a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts +++ b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.d.ts @@ -1,12 +1,12 @@ /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param paths Paths that needs to be cached after the build (same paths used to create a hash) + * @param path Path that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -export declare function actionCore(paths: string, cmd: string, logger: iLogger): Promise; +export declare function actionCore(path: string, cmd: string, logger: iLogger): Promise; export interface iLogger { debug(message: string): void; info(message: string): void; diff --git a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js index 9c522b4f72..cdfd66716e 100644 --- a/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js +++ b/.github/ga_packages/build_cache_executor/dist/build_cache_executor.js @@ -33,36 +33,34 @@ const cache = __importStar(require("@actions/cache")); const exec = __importStar(require("@actions/exec")); const folderHash = __importStar(require("folder-hash")); const fs = __importStar(require("fs-extra")); -const input_parsing = __importStar(require("./input_parsing")); /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param paths Paths that needs to be cached after the build (same paths used to create a hash) + * @param path Path that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -function actionCore(paths, cmd, logger) { +function actionCore(path, cmd, logger) { return __awaiter(this, void 0, void 0, function* () { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (paths.length === 0) { + if (path.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } - const parsedPaths = input_parsing.parse_paths(paths); let hashKey; try { - hashKey = cmd.concat(yield getHash(parsedPaths[0])); + hashKey = cmd.concat(yield getHash(path)); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${paths} is: ${hashKey}`); + logger.info(`Hash key for ${path} is: ${hashKey}`); try { - cacheHit = yield cache.restoreCache(parsedPaths, hashKey); + cacheHit = yield cache.restoreCache([path], hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); @@ -84,7 +82,7 @@ function actionCore(paths, cmd, logger) { } if (hashKey !== undefined) { try { - const cacheId = yield cache.saveCache(parsedPaths, hashKey); + const cacheId = yield cache.saveCache([path], hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { diff --git a/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts b/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts index 768cec5668..fe7a8dc0e9 100644 --- a/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts +++ b/.github/ga_packages/build_cache_executor/src/build_cache_executor.ts @@ -2,37 +2,35 @@ import * as cache from "@actions/cache"; import * as exec from "@actions/exec"; import * as folderHash from "folder-hash"; import * as fs from "fs-extra"; -import * as input_parsing from "./input_parsing"; /** * Builds and caches the resulting artifacts. In order to store the artifacts in a cache, a hash (cacheKey) is calculated over paths and the result is used as key in the cache dictionary. * The function can throw exceptions. - * @param paths Paths that needs to be cached after the build (same paths used to create a hash) + * @param path Path that needs to be cached after the build (same paths used to create a hash) * @param cmd Cmd to execute to obtain a build * @param logger Output stream where to print the messages * @returns CacheKey necessary to recover the cached build later on. Undefined is returned if something went wrong. */ -export async function actionCore(paths: string, cmd: string, logger: iLogger): Promise { +export async function actionCore(path: string, cmd: string, logger: iLogger): Promise { if (cmd.length === 0) { throw new Error(`No command was supplied, nothing to do.`); } - if (paths.length === 0) { + if (path.length === 0) { throw new Error(`No path was supplied, nothing to cache.`); } - const parsedPaths = input_parsing.parse_paths(paths); let hashKey: string | undefined; try { - hashKey = cmd.concat(await getHash(parsedPaths[0])); + hashKey = cmd.concat(await getHash(path)); } catch (err) { throw new Error(`While calculating the hash something went terribly wrong: ${err.message}`); } let cacheHit: string | undefined = undefined; if (hashKey !== undefined) { - logger.info(`Hash key for ${paths} is: ${hashKey}`); + logger.info(`Hash key for ${path} is: ${hashKey}`); try { - cacheHit = await cache.restoreCache(parsedPaths, hashKey); + cacheHit = await cache.restoreCache([path], hashKey); } catch (err) { logger.error(`Impossible to retrieve cache: ${err}\n The build will start momentarily...`); } @@ -56,7 +54,7 @@ export async function actionCore(paths: string, cmd: string, logger: iLogger): P if (hashKey !== undefined) { try { - const cacheId = await cache.saveCache(parsedPaths, hashKey); + const cacheId = await cache.saveCache([path], hashKey); logger.info(`Cache properly created with id ${cacheId}`); } catch (error) { throw new Error(`The cache could not be saved: ${error.message}`); diff --git a/.github/ga_packages/build_cache_executor/src/input_parsing.ts b/.github/ga_packages/build_cache_executor/src/input_parsing.ts deleted file mode 100644 index c4a651a533..0000000000 --- a/.github/ga_packages/build_cache_executor/src/input_parsing.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** @internal */ -export function parse_paths(paths: string): string[] { - // filter avoids empty elements - return paths.split("\n").filter((i) => i); -} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2726ff2b36..14b03bf17c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: REALM_CMAKE_CONFIGURATION: Release with: cmd: ./wrappers/build-macos.sh - cachePaths: ./wrappers + cachePath: ./wrappers build-wrappers-ios: runs-on: macos-latest @@ -30,7 +30,7 @@ jobs: uses: ./.github/actions/build_cache_executor with: cmd: ./wrappers/build-ios.sh --configuration=Release - cachePaths: ./wrappers + cachePath: ./wrappers build-wrappers-windows: runs-on: windows-latest @@ -44,16 +44,15 @@ jobs: with: submodules: recursive - name: Fetch dependencies - # uses: .\.github\actions\get-vcpkg-prebuilt - uses: .\.github\actions\build_cache_executor - with: - cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) - cachePaths: | - C:\ - !C:\System Volume Information + uses: .\.github\actions\get-vcpkg-prebuilt + # uses: .\.github\actions\build_cache_executor + # with: + # cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) + # cachePath: | + # C:\ + # !C:\System Volume Information - name: Build wrappers uses: .\.github\actions\build_cache_executor with: cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} - # cachePaths: .\wa!ppers -# + cachePath: .\wrappers From 69a4a36c05b05d17f80767299904fb57e55f33a9 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 31 Mar 2021 10:17:11 +0200 Subject: [PATCH 18/26] Second attempt to cache win dependencies --- .github/workflows/main.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 14b03bf17c..4bc26c9c9a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,14 +43,15 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + - name: Check if cached dependencies + id: dependencies-cache + uses: actions/cache@v2 + with: + path: 'C:\' + key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Fetch dependencies + if: steps.dependencies-cache.outputs.cache-hit != 'true' uses: .\.github\actions\get-vcpkg-prebuilt - # uses: .\.github\actions\build_cache_executor - # with: - # cmd: powershell (Invoke-WebRequest -Uri https://static.realm.io/downloads/vcpkg.zip -OutFile C:\vcpkg.zip) -and (Expand-Archive -Path C:\vcpkg.zip -DestinationPath C:\) - # cachePath: | - # C:\ - # !C:\System Volume Information - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From 45e9994a33197acab26bab333bb27bf018694ad9 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 31 Mar 2021 10:22:46 +0200 Subject: [PATCH 19/26] Added build of UWP wrappers --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4bc26c9c9a..652115221e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,3 +57,29 @@ jobs: with: cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} cachePath: .\wrappers + + build-wrappers-windows-uwp: + runs-on: windows-latest + name: Build Windows UWP wrappers + strategy: + matrix: + arch: [Win32, x64, ARM] + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Check if cached dependencies + id: dependencies-cache + uses: actions/cache@v2 + with: + path: 'C:\' + key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + - name: Fetch dependencies + if: steps.dependencies-cache.outputs.cache-hit != 'true' + uses: .\.github\actions\get-vcpkg-prebuilt + - name: Build wrappers + uses: .\.github\actions\build_cache_executor + with: + cmd: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }} + cachePath: .\wrappers From 230df65a74dba27f2e6012c41712f1388f67cffa Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 31 Mar 2021 11:37:29 +0200 Subject: [PATCH 20/26] Attemp to reduce steps in win builds --- .github/workflows/main.yml | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 652115221e..24c56c73a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,17 +32,10 @@ jobs: cmd: ./wrappers/build-ios.sh --configuration=Release cachePath: ./wrappers - build-wrappers-windows: + fetch-windows-dependencies: runs-on: windows-latest - name: Build Windows wrappers - strategy: - matrix: - arch: [Win32, x64] + name: Fetch windows dependencies steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - name: Check if cached dependencies id: dependencies-cache uses: actions/cache@v2 @@ -52,6 +45,19 @@ jobs: - name: Fetch dependencies if: steps.dependencies-cache.outputs.cache-hit != 'true' uses: .\.github\actions\get-vcpkg-prebuilt + + build-wrappers-windows: + runs-on: windows-latest + name: Build Windows wrappers + needs: fetch-windows-dependencies + strategy: + matrix: + arch: [Win32, x64] + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive - name: Build wrappers uses: .\.github\actions\build_cache_executor with: @@ -61,6 +67,7 @@ jobs: build-wrappers-windows-uwp: runs-on: windows-latest name: Build Windows UWP wrappers + needs: fetch-windows-dependencies strategy: matrix: arch: [Win32, x64, ARM] @@ -69,15 +76,6 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - - name: Check if cached dependencies - id: dependencies-cache - uses: actions/cache@v2 - with: - path: 'C:\' - key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - - name: Fetch dependencies - if: steps.dependencies-cache.outputs.cache-hit != 'true' - uses: .\.github\actions\get-vcpkg-prebuilt - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From 41b5a07df23c89c78b2d6bd6d2d377ca81c8a422 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 31 Mar 2021 11:38:54 +0200 Subject: [PATCH 21/26] Attemp to reduce steps in win builds - 2 --- .github/workflows/main.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24c56c73a7..46db49c0a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,6 +36,10 @@ jobs: runs-on: windows-latest name: Fetch windows dependencies steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive - name: Check if cached dependencies id: dependencies-cache uses: actions/cache@v2 @@ -54,10 +58,6 @@ jobs: matrix: arch: [Win32, x64] steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - name: Build wrappers uses: .\.github\actions\build_cache_executor with: @@ -72,10 +72,6 @@ jobs: matrix: arch: [Win32, x64, ARM] steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From 96702c83fe8160139a2e0319c5f8350517f81479 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 31 Mar 2021 12:32:34 +0200 Subject: [PATCH 22/26] Attemp to reduce steps in win builds - some fixes --- .github/workflows/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46db49c0a8..7d17ad424f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,7 +44,7 @@ jobs: id: dependencies-cache uses: actions/cache@v2 with: - path: 'C:\' + path: 'C:\src' key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Fetch dependencies if: steps.dependencies-cache.outputs.cache-hit != 'true' @@ -58,6 +58,10 @@ jobs: matrix: arch: [Win32, x64] steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive - name: Build wrappers uses: .\.github\actions\build_cache_executor with: @@ -72,6 +76,10 @@ jobs: matrix: arch: [Win32, x64, ARM] steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From 69f26ecb4d58780782d79f969dd5e5e8ceb597f1 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 6 Apr 2021 13:52:36 +0200 Subject: [PATCH 23/26] Forgot to fetch dependencies from cache --- .github/workflows/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d17ad424f..07145900bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,6 +62,11 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + - name: Obtain the cached dependencies + uses: actions/cache@v2 + with: + path: 'C:\src' + key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers uses: .\.github\actions\build_cache_executor with: @@ -80,6 +85,11 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + - name: Obtain the cached dependencies + uses: actions/cache@v2 + with: + path: 'C:\src' + key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers uses: .\.github\actions\build_cache_executor with: From d591c35c7b72cd0d29ef06069b71125a6f4d7ee7 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 6 Apr 2021 18:26:30 +0200 Subject: [PATCH 24/26] Added cache on win wrappers --- .github/workflows/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07145900bf..a3c837ec5c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,12 +62,20 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + - name: Check if contains wrappers already + uses: actions/cache@v2 + id: wrapper-cache + with: + path: ./wrappers/build/ + key: wrapper-windows-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} - name: Obtain the cached dependencies + if: steps.wrapper-cache.outputs.cache-hit != 'true' uses: actions/cache@v2 with: path: 'C:\src' key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers + if: steps.wrapper-cache.outputs.cache-hit != 'true' uses: .\.github\actions\build_cache_executor with: cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} @@ -85,12 +93,20 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + - name: Check if contains wrappers already + uses: actions/cache@v2 + id: wrapper-cache + with: + path: ./wrappers/build/ + key: wrapper-windows-uwp-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} - name: Obtain the cached dependencies + if: steps.wrapper-cache.outputs.cache-hit != 'true' uses: actions/cache@v2 with: path: 'C:\src' key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers + if: steps.wrapper-cache.outputs.cache-hit != 'true' uses: .\.github\actions\build_cache_executor with: cmd: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }} From f151335e3252d3f6431558c8ca7cecbb3ea95f08 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Tue, 6 Apr 2021 18:39:11 +0200 Subject: [PATCH 25/26] Revert to smartly use the default cache action --- .github/workflows/main.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3c837ec5c..531536470f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,10 +76,11 @@ jobs: key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers if: steps.wrapper-cache.outputs.cache-hit != 'true' - uses: .\.github\actions\build_cache_executor - with: - cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} - cachePath: .\wrappers + # uses: .\.github\actions\build_cache_executor + # with: + # cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} + # cachePath: .\wrappers + run: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} build-wrappers-windows-uwp: runs-on: windows-latest @@ -107,7 +108,8 @@ jobs: key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - name: Build wrappers if: steps.wrapper-cache.outputs.cache-hit != 'true' - uses: .\.github\actions\build_cache_executor - with: - cmd: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }} - cachePath: .\wrappers + # uses: .\.github\actions\build_cache_executor + # with: + # cmd: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }} + # cachePath: .\wrappers + run: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }} From 3cb43bddc98f1b354eaea2bc7326295217d519b0 Mon Sep 17 00:00:00 2001 From: Andrea Catalini Date: Wed, 7 Apr 2021 17:44:17 +0200 Subject: [PATCH 26/26] Check time to build with smaller dependencies arch and removed cache on wrappers --- .github/workflows/main.yml | 150 +++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 531536470f..52d501052c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,58 +2,58 @@ name: build and test on: [push] jobs: - build-wrappers-macos: - runs-on: macos-latest - name: Build macOs wrappers - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Build wrappers - uses: ./.github/actions/build_cache_executor - env: - REALM_CMAKE_CONFIGURATION: Release - with: - cmd: ./wrappers/build-macos.sh - cachePath: ./wrappers + # build-wrappers-macos: + # runs-on: macos-latest + # name: Build macOs wrappers + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # submodules: recursive + # - name: Build wrappers + # uses: ./.github/actions/build_cache_executor + # env: + # REALM_CMAKE_CONFIGURATION: Release + # with: + # cmd: ./wrappers/build-macos.sh + # cachePath: ./wrappers - build-wrappers-ios: - runs-on: macos-latest - name: Build iOS wrappers - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Build wrappers - uses: ./.github/actions/build_cache_executor - with: - cmd: ./wrappers/build-ios.sh --configuration=Release - cachePath: ./wrappers + # build-wrappers-ios: + # runs-on: macos-latest + # name: Build iOS wrappers + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # submodules: recursive + # - name: Build wrappers + # uses: ./.github/actions/build_cache_executor + # with: + # cmd: ./wrappers/build-ios.sh --configuration=Release + # cachePath: ./wrappers - fetch-windows-dependencies: - runs-on: windows-latest - name: Fetch windows dependencies - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Check if cached dependencies - id: dependencies-cache - uses: actions/cache@v2 - with: - path: 'C:\src' - key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} - - name: Fetch dependencies - if: steps.dependencies-cache.outputs.cache-hit != 'true' - uses: .\.github\actions\get-vcpkg-prebuilt + # fetch-windows-dependencies: + # runs-on: windows-latest + # name: Fetch windows dependencies + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # submodules: recursive + # - name: Check if cached dependencies + # id: dependencies-cache + # uses: actions/cache@v2 + # with: + # path: 'C:\src' + # key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + # - name: Fetch dependencies + # if: steps.dependencies-cache.outputs.cache-hit != 'true' + # uses: .\.github\actions\get-vcpkg-prebuilt build-wrappers-windows: runs-on: windows-latest name: Build Windows wrappers - needs: fetch-windows-dependencies + # needs: fetch-windows-dependencies strategy: matrix: arch: [Win32, x64] @@ -62,20 +62,22 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - - name: Check if contains wrappers already - uses: actions/cache@v2 - id: wrapper-cache - with: - path: ./wrappers/build/ - key: wrapper-windows-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} - - name: Obtain the cached dependencies - if: steps.wrapper-cache.outputs.cache-hit != 'true' - uses: actions/cache@v2 - with: - path: 'C:\src' - key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + # - name: Check if contains wrappers already + # uses: actions/cache@v2 + # id: wrapper-cache + # with: + # path: ./wrappers/build/ + # key: wrapper-windows-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} + # - name: Obtain the cached dependencies + # if: steps.wrapper-cache.outputs.cache-hit != 'true' + # uses: actions/cache@v2 + # with: + # path: 'C:\src' + # key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + - name: Fetch dependencies + uses: .\.github\actions\get-vcpkg-prebuilt - name: Build wrappers - if: steps.wrapper-cache.outputs.cache-hit != 'true' + # if: steps.wrapper-cache.outputs.cache-hit != 'true' # uses: .\.github\actions\build_cache_executor # with: # cmd: powershell .\wrappers\build.ps1 Windows -Configuration Release -Platforms ${{ matrix.arch }} @@ -85,7 +87,7 @@ jobs: build-wrappers-windows-uwp: runs-on: windows-latest name: Build Windows UWP wrappers - needs: fetch-windows-dependencies + # needs: fetch-windows-dependencies strategy: matrix: arch: [Win32, x64, ARM] @@ -94,20 +96,22 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - - name: Check if contains wrappers already - uses: actions/cache@v2 - id: wrapper-cache - with: - path: ./wrappers/build/ - key: wrapper-windows-uwp-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} - - name: Obtain the cached dependencies - if: steps.wrapper-cache.outputs.cache-hit != 'true' - uses: actions/cache@v2 - with: - path: 'C:\src' - key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + # - name: Check if contains wrappers already + # uses: actions/cache@v2 + # id: wrapper-cache + # with: + # path: ./wrappers/build/ + # key: wrapper-windows-uwp-${{ matrix.arch }}-${{hashfiles('./wrappers/**')}} + # - name: Obtain the cached dependencies + # if: steps.wrapper-cache.outputs.cache-hit != 'true' + # uses: actions/cache@v2 + # with: + # path: 'C:\src' + # key: dependencies-windows-${{hashfiles('.\wrappers\build.ps1')}} + - name: Fetch dependencies + uses: .\.github\actions\get-vcpkg-prebuilt - name: Build wrappers - if: steps.wrapper-cache.outputs.cache-hit != 'true' + # if: steps.wrapper-cache.outputs.cache-hit != 'true' # uses: .\.github\actions\build_cache_executor # with: # cmd: powershell .\wrappers\build.ps1 WindowsStore -Configuration Release -Platforms ${{ matrix.arch }}