Skip to content

Commit 74cd8eb

Browse files
committed
docs: add a github actions example to the readme [skip ci]
1 parent e9b7d58 commit 74cd8eb

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,53 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
3030
- choco
3131
- brew
3232

33+
# Usage
34+
35+
## Inside GitHub Actions
36+
37+
Here is a complete cross-platform example that tests llvm and gcc. It also uses cmake, ninja, conan, cppcheck, and ccache.
38+
39+
`.github/workflows/ci.yml`:
40+
41+
```yaml
42+
name: ci
43+
on:
44+
pull_request:
45+
push:
46+
branches:
47+
- main
48+
- master
49+
50+
jobs:
51+
Test:
52+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
os:
58+
- windows-2019
59+
- ubuntu-20.04
60+
- macos-10.15
61+
compiler:
62+
- llvm
63+
- gcc
64+
steps:
65+
- name: Setup Cpp
66+
uses: aminya/setup-cpp@master
67+
with:
68+
compiler: ${{ matrix.compiler }}
69+
cmake: true
70+
ninja: true
71+
conan: true
72+
cppcheck: true
73+
ccache: true
74+
```
75+
76+
In the `compiler` entry, you can specify the version after a `-`. For example, `llvm-11`.
77+
78+
For the tools, instead of `true`, which choses the default version, you can pass a specific version.
79+
3380
### Incomplete
3481

3582
- [ ] msvc. It is implemented, but has bugs. See [this issue](https://github.com/aminya/cpp/issues/1)

0 commit comments

Comments
 (0)