Skip to content

Commit

Permalink
fix log output
Browse files Browse the repository at this point in the history
  • Loading branch information
lukka committed Apr 3, 2023
1 parent b31715b commit 4021cfa
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 86 deletions.
36 changes: 20 additions & 16 deletions README.md
Expand Up @@ -58,9 +58,10 @@ jobs:
# Or pin to a specific CMake version:
# lukka/get-cmake@v3.21.2

# Run vcpkg leveraging its own binary caching integration with GitHub Action
# cache. Since vcpkg.json is being used later on to install the packages
# when `run-cmake` runs, no packages are installed at this time.
# Setup vcpkg: ensures vcpkg is downloaded and built.
# Since vcpkg.json is being used later on to install the packages
# when `run-cmake` runs, no packages are installed at this time
# (and vcpkg does not run).
- name: Setup vcpkg (it does not install any package yet)
uses: lukka/run-vcpkg@v11
#with:
Expand All @@ -69,8 +70,8 @@ jobs:
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'

# If not using a submodule for vcpkg sources, this specifies which commit
# id must be checkout from a Git repo. It must not be set if using a
# submodule for vcpkg.
# id must be checkout from a Git repo.
# Note: it must not be set if using a Git submodule for vcpkg.
# vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}'

# This is the glob expression used to locate the vcpkg.json.
Expand All @@ -81,7 +82,7 @@ jobs:
# `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
# vcpkgJsonGlob: '**/vcpkg.json'

# This is only needed if running `vcpkg install` is needed at this step.
# This is only needed if the command `vcpkg install` must run at this step.
# Instead it is highly suggested to let `run-cmake` to run vcpkg later on
# using the vcpkg.cmake toolchain. The default is `false`.
# runVcpkgInstall: true
Expand Down Expand Up @@ -123,10 +124,11 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/

```
┌──────────────────────────┐
| Skipped by default. |
│ Compute cache key from: │ Inputs:
│ - vcpkg Git commit │ - `vcpkgGitCommitId`
│ - platform and OS │
└─────────────┬────────────┘
│ - platform and OS │ - `doNotCache`: set to false
└─────────────┬────────────┘ to run this block.
┌─────────────────────────┐ Inputs:
Expand All @@ -135,9 +137,10 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
┌─────────────────────────┐ Inputs:
| Skipped by default. |
│ Restore vcpkg │ - `vcpkgDirectory`
│ from the GH cache
└────────────┬────────────┘
│ from the GH cache. │ - `doNotCache`: set to false
└────────────┬────────────┘ to run this block.
┌─────────────────────────┐
Expand All @@ -150,7 +153,7 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
┌─────────────────────────┐
│ Rebuild vcpkg executable│ Inputs:
│ if not in sync with │ - `vcpkgGitCommitId`
│ sources │ - `vcpkgGitURL`
│ sources. │ - `vcpkgGitURL`
└────────────┬────────────┘
Expand All @@ -161,7 +164,7 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
┌─────────────────────────┐ │
│ Launch `vcpkg install` │ │ Inputs:
│ where vcpkg.json has │ │ - `runVcpkgFormatString`
│ been located │ │ Environment variables:
│ been located. │ │ Environment variables:
└────────────┬────────────┘ │ - `VCPKG_DEFAULT_TRIPLET` is used. If not yet
│ │ set, it is set to the current platform.
│ │ - `VCPKG_INSTALLED_DIR` is used as value for
Expand All @@ -171,14 +174,15 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
┌─────────────────────────┐ │ set, it is set to leverage the GitHub Action
│ Set `VCPKG_ROOT` and │ │ cache storage for Binary Caching artifacts.
│ `VCPKG_DEFAULT_TRIPLET` │ │
│ workflow-wide env vars │ │
│ workflow-wide env vars. │ │
└────────────┬────────────┘ │
├───────────── ┘
┌─────────────────────────┐
│ If no cache-hit, │ Inputs:
│ store vcpkg onto │ - `doNotCache`: disable the caching of the vcpkg
│ GH cache │ executable and its data files.
| Skipped by default. |
│ If no cache-hit, │ Inputs:
│ store vcpkg onto │ - `doNotCache`: set to false to
│ GH cache │ run this block.
└────────────┬────────────┘
|
Expand Down
22 changes: 13 additions & 9 deletions dist/index.js
Expand Up @@ -122,8 +122,9 @@ class VcpkgAction {
// Ensure vcpkg root is set.
if (!vcpkgRoot) {
vcpkgRoot = yield runvcpkglib.getDefaultVcpkgDirectory(this.baseUtilLib.baseLib);
baseLib.info(`The vcpkg's root directory is not provided, using the predefined: '${this.vcpkgRootDir}'`);
baseLib.info(`The vcpkg's root directory is not provided, using the default value: '${this.vcpkgRootDir}'`);
}
baseLib.info(`The vpckg root directory: '${vcpkgRoot}'`);
// Create the vcpkg_root and cache directory if needed.
const binCachePath = (_a = this.binaryCachePath) !== null && _a !== void 0 ? _a : yield runvcpkglib.getDefaultVcpkgCacheDirectory(this.baseUtilLib.baseLib);
baseLib.debug(`vcpkgRootDir=${this.vcpkgRootDir}, binCachePath=${binCachePath}`);
Expand All @@ -136,20 +137,21 @@ class VcpkgAction {
if (!this.vcpkgRootDir) {
throw new Error(`vcpkgRootDir is not defined!`);
}
let vcpkgJsonFilePath = null;
const vcpkgJsonPath = yield vcpkgutil.Utils.getVcpkgJsonPath(this.baseUtilLib, this.vcpkgJsonGlob, this.vcpkgJsonIgnores);
vcpkgJsonFilePath = yield this.getCurrentDirectoryForRunningVcpkg(vcpkgJsonPath);
const vcpkgJsonFilePath = yield this.baseUtilLib.wrapOp(`Searching for vcpkg.json with glob expression '${this.vcpkgJsonGlob}'`, () => __awaiter(this, void 0, void 0, function* () {
const vcpkgJsonPath = yield vcpkgutil.Utils.getVcpkgJsonPath(this.baseUtilLib, this.vcpkgJsonGlob, this.vcpkgJsonIgnores);
return yield this.getCurrentDirectoryForRunningVcpkg(vcpkgJsonPath);
}));
let isCacheHit = null;
let cacheKey = null;
if (this.doNotCache) {
this.baseUtilLib.baseLib.debug(`Skipping restoring vcpkg as caching is disabled. Set input 'doNotCache:false' to enable caching.`);
}
else {
cacheKey =
yield this.baseUtilLib.wrapOp('Compute vcpkg cache key', () => __awaiter(this, void 0, void 0, function* () {
yield this.baseUtilLib.wrapOp('Computing vcpkg cache key', () => __awaiter(this, void 0, void 0, function* () {
const keys = yield vcpkgutil.Utils.computeCacheKeys(this.baseUtilLib, this.vcpkgRootDir, // HACK: if it were not set it would have thrown before.
this.userProvidedCommitId);
if (keys && vcpkgJsonPath) {
if (keys) {
baseLib.info(`Computed key: ${JSON.stringify(keys)}`);
}
else {
Expand Down Expand Up @@ -44134,9 +44136,11 @@ class VcpkgRunner {
}
// If running in a GitHub Runner, enable the GH's cache provider for the vcpkg's binary cache.
if (process.env['GITHUB_ACTIONS'] === 'true') {
// Allow users to define the vcpkg's binary source explicitly in the workflow, in that case don't override it.
if (!process.env[globals.VCPKG_BINARY_SOURCES])
this.baseUtils.setVariableVerbose(globals.VCPKG_BINARY_SOURCES, VcpkgRunner.VCPKG_BINARY_SOURCES_GHA);
yield this.baseUtils.wrapOp(`Setup to run on GitHub Action runners`, () => __awaiter(this, void 0, void 0, function* () {
// Allow users to define the vcpkg's binary source explicitly in the workflow, in that case don't override it.
if (!process.env[globals.VCPKG_BINARY_SOURCES])
this.baseUtils.setVariableVerbose(globals.VCPKG_BINARY_SOURCES, VcpkgRunner.VCPKG_BINARY_SOURCES_GHA);
}));
}
// Ensuring `this.vcpkgDestPath` is existent, since is going to be used as current working directory.
if (!(yield this.baseUtils.baseLib.exist(this.vcpkgDestPath))) {
Expand Down
94 changes: 47 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -43,11 +43,11 @@
"@actions/exec": "^1.1.1",
"@actions/github": "^5.0.3",
"@actions/io": "^1.1.2",
"@lukka/action-lib": "3.5.1",
"@lukka/assets-lib": "3.5.1",
"@lukka/base-lib": "3.5.1",
"@lukka/base-util-lib": "3.5.1",
"@lukka/run-vcpkg-lib": "3.5.1",
"@lukka/action-lib": "3.5.2",
"@lukka/assets-lib": "3.5.2",
"@lukka/base-lib": "3.5.2",
"@lukka/base-util-lib": "3.5.2",
"@lukka/run-vcpkg-lib": "3.5.2",
"@types/adm-zip": "^0.4.32",
"@types/follow-redirects": "^1.14.1",
"@types/jest": "^26.0.14",
Expand Down

0 comments on commit 4021cfa

Please sign in to comment.