Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason committed Jul 14, 2022
1 parent b580eab commit a8baefa
Showing 1 changed file with 47 additions and 9 deletions.
56 changes: 47 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
#vcpkg-action
# vcpkg-action

`vcpkg-action` is a simple action to build and cache vcpkg packages. It currently only supports Windows. `vcpkg` is cloned in the `${{ github.workspace }}\vcpkg` directory, and the build products are located in `${{ github.workspace }}\vcpkg\installed\<triplet>`. For cmake, use the option:
`vcpkg-action` is a simple action to build and cache vcpkg packages. It supports all platforms. It has two unique
features:

* Simplicity
* Use of a "dry-run" build to generate a unique cache key for the configuration. This guarantees that if packages
change, the cache will be rebuilt, but avoids rebuilding when it isn't necessary.

`vcpkg` is cloned to the `${{ github.workspace }}\vcpkg` directory, and the build products are located in
`${{ github.workspace }}\vcpkg\installed\<triplet>`. For cmake, use the option:

```
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=<triplet>
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=<triplet>
```

Another directory named `vcpkg_cache` is created in the workspace root. This directory is used to store the cache files, and is cached using `pat-s/always-upload-cache@v3`. The cache key is automatically generated, but can also be modified using the `cache-key` argument.
Another directory named `vcpkg_cache` is created in the workspace root. This directory is used to store the cache files,
and is cached using `pat-s/always-upload-cache@v3`. The cache key is automatically generated,
but can also be modified using the `cache-key` argument.

Example usage:
Simple usage example:

```yaml
- name: vcpkg build
uses: johnwason/vcpkg-action@v1
uses: johnwason/vcpkg-action@v2
with:
pkgs: boost-date-time boost-system
triplet: x64-windows-release
Expand All @@ -22,7 +31,7 @@ Example usage:
## Usage
```yaml
- uses: johnwason/vcpkg-action@v1
- uses: johnwason/vcpkg-action@v2
with:
# The vcpkg packages to build, separated by spaces
pkgs: ''
Expand All @@ -31,7 +40,36 @@ Example usage:
triplet: ''
# Extra arguments to pass to vcpkg command (optional)
extra-args: ''
# Additional string to add to cache key (optional)
# Additional string to add to cache key. If using a build matrix or building different configurations
# on the same operating system, be sure to include an additional cache key to separate the caches. (optional)
cache-key: ''

```

## Advanced Example

The following is an advanced example with a matrix build. Note that the runner name is included as an additional
cache key.

```yaml
jobs:
buildme:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-20.04
vcpkg_triplet: x64-linux-release
- os: macos-11
vcpkg_triplet: x64-osx-release
- os: windows-2019
vcpkg_triplet: x64-windows-release
steps:
- name: vcpkg build
uses: johnwason/vcpkg-action@v2
with:
pkgs: boost-date-time
triplet: ${{ matrix.config.vcpkg_triplet }}
cache-key: ${{ matrix.config.os }}
```

0 comments on commit a8baefa

Please sign in to comment.