diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 1492053..cacab7b 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -10,9 +10,38 @@ jobs: - name: Retrieve files shell: bash run: | - echo Sync files with server - echo "We are in $PWD" git clone ${{ gitea.server_url }}/${{ gitea.repository }} www - cd www - echo "We have : $(ls -lta)" + - name: Synchronize files + shell: bash + run: | + rsync -avzlh --delete --filter='P sidebar/*' * /home/webmaster/site-chalec.org/articles/ + echo $(git diff-tree --no-commit-id --name-only -r master | grep stl || find . -name "*.stl" -printf "%P\n") > /home/webmaster/site-chalec.org/.modified + - run: echo "Job ended with status '${{ job.status }}'." + + tests: + runs-on: linux_amd64 + steps: + - name: Syntax & validity checks + shell: bash + run: | + cd /home/webmaster/site-chalec.org + files=$(cat .modified) + if [ -z "$files" ]; then + files=$(find . -name "*.stl" -printf %P) + errors=0 + for file in $files + do + echo "### Test de $file" + stl log clean + stl check -F $file | grep -e "Err" -e "erreur de" -e "Aucun fichier" && errors=$((errors+1)) # error if err is read in standard output + done + [ $errors -gt 0 ] && false + for file in $files + do + echo "Test supplémentaire de $file" + stl log clean + stl check -F $file &> /dev/null + stl check -F $file &> /dev/null + done + [ $errors -gt 0 ] && false - run: echo "Job ended with status '${{ job.status }}'."