Skip to content

Commit c69a8a5

Browse files
authored
Create leetcode.yml
1 parent 82ca9f9 commit c69a8a5

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/leetcode.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: LeetCode C/C++ CI
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.c'
7+
- '**/*.cpp'
8+
- '**/*.h'
9+
- '**/*.hpp'
10+
pull_request:
11+
paths:
12+
- '**/*.c'
13+
- '**/*.cpp'
14+
- '**/*.h'
15+
- '**/*.hpp'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
25+
- name: Set up C/C++ compiler
26+
uses: actions/setup-cpp@v1
27+
with:
28+
compiler: gcc
29+
30+
- name: Compile code
31+
run: |
32+
mkdir build
33+
cd build
34+
cmake ..
35+
make
36+
37+
- name: Run basic checks
38+
run: |
39+
cd build
40+
for file in ../*.cpp ../*.c; do
41+
if [ -f "$file" ]; then
42+
./$(basename "$file" .cpp) || ./$(basename "$file" .c)
43+
fi
44+
done

0 commit comments

Comments
 (0)