www/.forgejo/workflows/ci.yaml

66 lines
2.0 KiB
YAML
Raw Normal View History

2023-10-20 10:08:58 +02:00
on:
push:
branches:
- 'master'
2023-10-20 09:29:31 +02:00
jobs:
2023-10-20 09:36:00 +02:00
synchro:
2023-10-20 09:29:31 +02:00
runs-on: linux_amd64
steps:
2023-10-20 10:49:00 +02:00
- name: Retrieve files
2023-10-20 10:08:58 +02:00
shell: bash
2023-10-20 09:49:43 +02:00
run: |
2023-10-20 10:51:32 +02:00
git clone ${{ gitea.server_url }}/${{ gitea.repository }} www
2023-10-20 11:02:59 +02:00
- name: Synchronize files
shell: bash
run: |
2023-10-20 11:25:25 +02:00
cd www
2023-10-20 11:28:38 +02:00
rsync -avzlh --delete --filter='P sidebar/*' * /home/webmaster/site-chalec.org/articles/
2023-10-20 11:02:59 +02:00
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)
2023-10-20 11:06:47 +02:00
fi
2023-10-20 11:02:59 +02:00
errors=0
for file in $files
do
echo "### Test de $file"
stl log clean
2023-10-20 11:21:15 +02:00
stl check $file -F | grep -e "Err" -e "erreur de" -e "Aucun fichier" && errors=$((errors+1)) # error if err is read in standard output
2023-10-20 11:02:59 +02:00
done
[ $errors -gt 0 ] && false
2023-10-20 11:13:05 +02:00
true
2023-10-20 11:18:26 +02:00
deploiement:
runs-on: linux_amd64
steps:
- name: Build html files
shell: bash
run: |
cd /home/webmaster/site-chalec.org
files=$(cat .modified)
if [ -z "$files" ]; then
files=$(find . -name "*.stl" -printf %P)
fi
errors=0
for file in $files
do
echo "Construction de $file"
stl log clean
2023-10-20 11:21:15 +02:00
stl wip $file -F | grep -e "Err" -e "erreur de" -e "Aucun fichier" && errors=$((errors+1)) # error if err is read in standard output
2023-10-20 11:18:26 +02:00
done
[ $errors -gt 0 ] && false
true
- name: Rebuild the sidebar
shell: bash
run: stl sidebar load