Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI

on: [push]

jobs:
Test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Extract example from README.md and run
run: .github/workflows/test.sh
18 changes: 18 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -ex

cat README.md | sed -n '/```ini/,/```/p' | grep -v '```' > config.ini

cat > example.c <<EOF
#include "src/ini.h"
#include "stdio.h"
#include "stddef.h"
int main(){
EOF
cat README.md | sed -n '/```c/,/```/p' | grep -v '```' >> example.c
echo 'return 0;' >> example.c
echo '}' >> example.c

gcc example.c src/ini.c -o example ${CFLAGS} -Wall -Wextra -Werror

./example