Skip to content

Commit

Permalink
Merge pull request #1 from minhqdao/add-ci
Browse files Browse the repository at this point in the history
Add CI workflow
  • Loading branch information
minhqdao authored Feb 19, 2023
2 parents 3349b1c + 70028c1 commit dd1208b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fortran-lang/setup-fpm@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: fpm test

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Check formatting
run: |
pip install fprettify
diff=$(fprettify -i 2 -r . -d)
if [[ $diff ]]; then
red="\033[0;31m"
cyan="\033[0;36m"
reset="\033[0m"
printf -- "$diff\n"
printf "${red}The code is not correctly formatted. Please run: ${reset}\n"
printf "${cyan}fprettify -i 2 -r .${reset}\n"
exit 1
fi
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ Run tests with:
fpm test
```

## Formatting

The CI will fail if the code is not formatted correctly. Please configure your
editor to use [fprettify](https://pypi.org/project/fprettify/) and use an
indentation width of 2 or run `fprettify -i 2 -r .` before committing.

## Contribute

Feel free to [create an issue](https://github.com/minhqdao/version-f/issues) in case you found a bug, have any questions or
Expand Down

0 comments on commit dd1208b

Please sign in to comment.