docs: add a github actions example to the readme [skip ci]

This commit is contained in:
Amin Yahyaabadi 2021-09-17 10:27:08 -05:00
parent e9b7d582e2
commit 74cd8eb948
1 changed files with 47 additions and 0 deletions

View File

@ -30,6 +30,53 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
- choco
- brew
# Usage
## Inside GitHub Actions
Here is a complete cross-platform example that tests llvm and gcc. It also uses cmake, ninja, conan, cppcheck, and ccache.
`.github/workflows/ci.yml`:
```yaml
name: ci
on:
pull_request:
push:
branches:
- main
- master
jobs:
Test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-2019
- ubuntu-20.04
- macos-10.15
compiler:
- llvm
- gcc
steps:
- name: Setup Cpp
uses: aminya/setup-cpp@master
with:
compiler: ${{ matrix.compiler }}
cmake: true
ninja: true
conan: true
cppcheck: true
ccache: true
```
In the `compiler` entry, you can specify the version after a `-`. For example, `llvm-11`.
For the tools, instead of `true`, which choses the default version, you can pass a specific version.
### Incomplete
- [ ] msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/cpp/issues/1)