Add CI/CD pipeline #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Validate Java files | |
run: | | |
for file in $(find . -name "Solution.java"); do | |
echo "Compiling $file" | |
javac "$file" | |
done | |
- name: Check README files exist | |
run: | | |
for dir in */; do | |
if [ -d "$dir" ] && [ "$dir" != ".git/" ] && [ "$dir" != ".github/" ]; then | |
if [ ! -f "${dir}README.md" ]; then | |
echo "Missing README.md in ${dir}" | |
exit 1 | |
fi | |
if [ ! -f "${dir}Solution.java" ]; then | |
echo "Missing Solution.java in ${dir}" | |
exit 1 | |
fi | |
fi | |
done | |
- name: Validate markdown files | |
uses: DavidAnson/markdownlint-cli2-action@v11 | |
with: | |
globs: "**/*.md" |