Skip to content

Commit

Permalink
- drop gulp.
Browse files Browse the repository at this point in the history
- update all deps to latest.
- update node to v20.
  • Loading branch information
lukka committed Nov 3, 2023
1 parent ed58931 commit 3cb0ece
Show file tree
Hide file tree
Showing 11 changed files with 45,247 additions and 40,214 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules
/dist
/node_modules
.eslintrc.js
*.js
14 changes: 7 additions & 7 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 1 * * SUN'
- cron: '0 1 * * *'
workflow_dispatch:

jobs:
Expand All @@ -22,18 +22,18 @@ jobs:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '20.x'
# How to consume GitHub packages, from this message (!): https://github.community/t/download-from-github-package-registry-without-authentication/14407/35
# Inspired from here: https://github.com/jcansdale-test/npmrc-configurations/blob/master/.github/workflows/blank.yml
- name: Authenticate to GitHub Packages
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com/" >> ~/.npmrc
- run: |
npm install
npm run test
name: build and test
shell: bash
- run: npm install
- run: npm run build
- run: npm run lint
- run: npm run test
- run: npm run pack
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
Expand Down
21 changes: 15 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
# Contributing
* [Prerequisites](#prerequisites)
* [Building](#build-and-lint)
* [Packaging](#packaging)
* [Testing](#testing)
- [Contributing](#contributing)
- [Prerequisites](#prerequisites)
- [Setup for consuming GitHub Registry public packages](#setup-for-consuming-github-registry-public-packages)
- [Build and lint](#build-and-lint)
- [Packaging](#packaging)
- [Testing](#testing)

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the [source code](https://github.com/lukka/run-vcpkg) with fixes and new features contributed by means of Pull Requests.


## Prerequisites
[gulp 4](https://www.npmjs.com/package/gulp4) globally installed.

### Setup for GitHub Registry public packages
Run

```bash
npm install
```

to populate the dependencies in `./node_modules` directory.

### Setup for consuming GitHub Registry public packages

`run-vcpkg` depends on public NPM packages published by [lukka/run-cmake-vcpkg-action-libs](https://github.com/lukka/run-cmake-vcpkg-action-libs) in the [GitHub Packages registry](https://docs.github.com/en/free-pro-team@latest/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages).
Unexpectedly, a public package still requires authentication when downloading it, hence if you want to `npm install` those packages correctly, you need to obtain a token with `read:packages` scope. Then create in the root of the repository a `.npmrc` file with the following content:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2019-2020-2021-2022 Luca Cappa
Copyright (c) 2019-2020-2021-2022-2023 Luca Cappa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
88 changes: 62 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Coverage Status](https://coveralls.io/repos/github/lukka/run-vcpkg/badge.svg?branch=main)](https://coveralls.io/github/lukka/run-vcpkg?branch=main)

- [**run-vcpkg@v11 requires vcpkg more recent than 2023-03-29 (e.g. commit id 5b1214315250939257ef5d62ecdcbca18cf4fb1c)**](#run-vcpkgv11-requires-vcpkg-more-recent-than-2023-03-29-eg-commit-id-5b1214315250939257ef5d62ecdcbca18cf4fb1c)
- [Important: **run-vcpkg@v11 requirements**](#important-run-vcpkgv11-requirements)
- [Quickstart with a C++ project template](#quickstart-with-a-c-project-template)
- [The **run-vcpkg@v11** action](#the-run-vcpkgv11-action)
- [Quickstart with instructions](#quickstart-with-instructions)
Expand All @@ -17,31 +17,33 @@
- [Disclaimer](#disclaimer)
- [Contributing](#contributing)

# **run-vcpkg@v11 requires vcpkg more recent than 2023-03-29 (e.g. commit id 5b1214315250939257ef5d62ecdcbca18cf4fb1c)**
# Important: **run-vcpkg@v11 requirements**

`run-vcpkg@v11` requires vcpkg more recent than 2023-03-29 (e.g. commit id `5b1214315250939257ef5d62ecdcbca18cf4fb1c`).

# Quickstart with a C++ project template

Take a look at this [C++ project template](https://github.com/lukka/CppCMakeVcpkgTemplate/tree/v11) that applies all the following instructions, but also shows how to create a __pure__ workflow without using special GitHub action that you cannot run locally on your development machine, but directly using the tools (`CMake`, `Ninja`, `vcpkg`, `C++` compilers) you already use daily.

# [The **run-vcpkg@v11** action](https://github.com/marketplace/actions/run-vcpkg)

The **run-vcpkg** action setups (and optionally runs) [vcpkg](https://github.com/microsoft/vcpkg) to install the packages specified in the `vcpkg.json` manifest file.
It leverages the vcpkg's Binary Caching backed to GitHub Action cache, delegating cache and key management to vpckg.
The **run-vcpkg@v11** action setups (and optionally runs) [vcpkg](https://github.com/microsoft/vcpkg) to install the packages specified in the `vcpkg.json` manifest file.
It leverages the vcpkg's [Binary Caching](https://learn.microsoft.com/en-us/vcpkg/users/binarycaching) backed to [GitHub Action cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows), delegating cache and key management to vpckg.

Special features which provide added value over a __pure__ workflow are:
- automatic caching leveraging `vcpkg`'s ability to store its [Binary Caching](https://learn.microsoft.com/en-us/vcpkg/users/binarycaching) artifacts onto the [GitHub Action cache](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows) so that packages are built only once and reused in subsequent workflow runs. The user can customize the behavior by setting the environment variable `VCPKG_BINARY_SOURCES` *before* vcpkg runs.
- set the workflow variables `ACTIONS_CACHE_URL` and `ACTIONS_RUNTIME_TOKEN` to let users easily running vcpkg
in a `run` step such as `- run: vcpkg install` or `- run: vcpkg integrate install` without forcing the
in a `run` step such as `- run: vcpkg install` or `- run: vcpkg integrate install` without forcing the
users to set the variables manually.
- automatic dump of log files created by `CMake` (e.g., `CMakeOutput.log`) and `vcpkg`. The content of those files flow into the workflow output log. Customizable by the user by setting the input `logCollectionRegExps`.
- automatic parsing of `CMake`, `vcpkg` and `gcc`, `clang`, `msvc` errors, reporting them contextually in the workflow summary by means of annotations.
- although disabled by default (see input `doNotCache`), `run-vcpkg` can cache vcpkg's executable and data files to speed up subsequent workflow runs. Since bootstrapping `vcpkg` already downloads a prebuilt binary saving the time to build `vcpkg`,
- although disabled by default (see input `doNotCache`), `run-vcpkg` can cache vcpkg's executable and data files to speed up subsequent workflow runs. Since bootstrapping `vcpkg` already downloads a prebuilt binary saving the time to build `vcpkg`,
this form of caching is useful only when the prebuilt executable is not served as it happens for the ARM platform.
Note this cache does not contain the libraries built by vcpkg, which is instead managed by vcpkg itself.

The provided [samples](#samples) use [GitHub hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners).

Good companions are the [run-cmake](https://github.com/marketplace/actions/run-cmake) action and the
Good companions are the [run-cmake](https://github.com/marketplace/actions/run-cmake) and the
[get-cmake](https://github.com/marketplace/actions/get-cmake) actions.

<br>
Expand All @@ -57,73 +59,102 @@ It is __highly recommended__ to use:
jobs:
build:
steps:
#-uses: actions/cache@v1 <===== YOU DO NOT NEED THIS!
#-uses: actions/cache@v3 <===== YOU DO NOT NEED THIS!

# Install latest CMake.
# Install latest CMake and Ninja.
- uses: lukka/get-cmake@latest
# Or pin to a specific CMake version:
# lukka/get-cmake@v3.21.2
# lukka/get-cmake@v3.27

# 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
# 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
- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11 # Always specify the specific _version_ of the
# action you need, `v10` in this case to stay up
# to date with fixes on the v11 branch.
#with:
# This is the default location of the directory containing vcpkg sources.
# Change it to the right location if needed.
# vcpkgDirectory: '${{ github.workspace }}/vcpkg'

# If not using a submodule for vcpkg sources, this specifies which commit
# id must be checkout from a Git repo.
# 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.
# 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

# This is only needed if `runVpkgInstall` is `true`.
# This glob expression used to locate the vcpkg.json and use
# its directory location as `working directory` when running `vcpkg install`.
# Change it to match a single manifest file you want to use.
# Note: do not use `${{ github.context }}` to compose the value as it
# contains backslashes that would be misinterpreted. Instead
# compose a value relative to the root of the repository using
# `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
# vcpkgJsonGlob: '**/vcpkg.json'

# 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

- name: Run CMake consuming CMakePreset.json and run vcpkg to build dependencies
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
# This is the default path to the CMakeLists.txt along side the
# CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json
# located elsewhere.
# cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'

# You could use CMake workflow presets defined in the CMakePresets.json
# with just this line below. Note this one cannot be used with any other
# preset input, it is mutually exclusive.
# workflowPreset: 'workflow-name'

# This is the name of the CMakePresets.json's configuration to use to generate
# the project files. This configuration leverages the vcpkg.cmake toolchain file to
# run vcpkg and install all dependencies specified in vcpkg.json.
configurePreset: 'ninja-multi-vcpkg'
# Additional arguments can be appended to the cmake command.
# This is useful to reduce the number of CMake's Presets since you can reuse
# an existing preset with different variables.
configurePresetAdditionalArgs: "['-DENABLE_YOUR_FEATURE=1']"

# This is the name of the CMakePresets.json's configuration to build the project.
buildPreset: 'ninja-multi-vcpkg'
# Additional arguments can be appended when building, for example to specify the
# configuration to build.
# This is useful to reduce the number of CMake's Presets you need in CMakePresets.json.
buildPresetAdditionalArgs: "['--config Release']"

# This is the name of the CMakePresets.json's configuration to test the project with.
testPreset: 'ninja-multi-vcpkg'
# Additional arguments can be appended when testing, for example to specify the config
# to test.
# This is useful to reduce the number of CMake's Presets you need in CMakePresets.json.
testPresetAdditionalArgs: "['--config Release']"

#env:
# By default the action disables vcpkg's telemetry by defining VCPKG_DISABLE_METRICS.
# This behavior can be disabled by defining `VCPKG_ENABLE_METRICS` as follows.
# VCPKG_ENABLE_METRICS: 1
#
# [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one
# for the hosting system will be automatically choosen (x64 is the default on all
# platforms, e.g. `x64-osx`).
# VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
#
# [OPTIONAL] By default the action disables vcpkg's telemetry by defining VCPKG_DISABLE_METRICS.
# This behavior can be disabled by defining `VCPKG_ENABLE_METRICS` as follows.
# VCPKG_ENABLE_METRICS: 1
#
```

<br>

## Action reference: all input/output parameters

Description of all input parameters: [action.yml](https://github.com/lukka/run-vcpkg/blob/main/action.yml)

<br>

## Flowchart

Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/blob/main/action.yml) which let customize the flow.
Expand Down Expand Up @@ -179,7 +210,7 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
│ │ - `VCPKG_INSTALLED_DIR` is used as value for
│ │ `--x-install-root` when running `vcpkg install`.
│ │ Check out the `runVcpkgFormatString` input.
▼ │ - `VCPKG_BINARY_SOURCES` is used. If not yet
▼ │ - `VCPKG_BINARY_SOURCES` is used. If not yet
┌─────────────────────────┐ │ set, it is set to leverage the GitHub Action
│ Set `VCPKG_ROOT` and │ │ cache storage for Binary Caching artifacts.
│ `VCPKG_DEFAULT_TRIPLET` │ │
Expand All @@ -198,6 +229,7 @@ Flowchart with related input in [action.yml](https://github.com/lukka/run-vcpkg/
```

<br>

## Best practices

Expand Down Expand Up @@ -244,10 +276,14 @@ All the content in this repository is licensed under the [MIT License](LICENSE.t

Copyright © 2019-2020-2021-2022-2023 Luca Cappa

<br>

# Disclaimer

The software is provided as is, there is no warranty of any kind. All users are encouraged to improve the [source code](https://github.com/lukka/run-vcpkg) with fixes and new features.

<br>

# Contributing

Read [CONTRIBUTING.md](CONTRIBUTING.md)
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ inputs:
description: "Specifies a semicolon separated list of regular expressions that are used to identify log file paths in the workflow output. A regular expression must have a single capturing group, that is a single pair of parenthesis such as 'See also (.+.log)'. When a match occurs, the content of the file is written into the workflow output for disclosing its content to the user. The default regular expressions are for CMake's and vcpkg's log files."

runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'

branding:
Expand Down
Loading

0 comments on commit 3cb0ece

Please sign in to comment.