ci: Reformat yaml file

Includes a formatter script
This commit is contained in:
Dorota Czaplejewicz
2021-12-08 19:37:49 +00:00
parent 2ac4980db9
commit f986f14220
2 changed files with 62 additions and 22 deletions

View File

@ -17,9 +17,9 @@ build_docs:
paths:
- _build
script:
- apt-get -y install python3-pip python3-sphinx
- pip3 install recommonmark
- ./doc/build.sh _build
- apt-get -y install python3-pip python3-sphinx
- pip3 install recommonmark
- ./doc/build.sh _build
except:
variables:
- $PKG_ONLY == "1"
@ -42,33 +42,37 @@ build_deb:
stage: build
artifacts:
paths:
- "*.deb"
- '*.deb'
script:
- rm -f ../*.deb
- apt-get -y build-dep .
- apt-get -y install devscripts
- REV=$(git log -1 --format=%h)
- VER=$(dpkg-parsechangelog -SVersion)
- 'DEBFULLNAME="Librem5 CI" EMAIL="librem5-builds@lists.community.puri.sm" dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG"'
- debuild -i -us -uc -b
- cp ../*.deb .
- rm -f ../*.deb
- apt-get -y build-dep .
- apt-get -y install devscripts
- REV=$(git log -1 --format=%h)
- VER=$(dpkg-parsechangelog -SVersion)
- DEBFULLNAME="Librem5 CI"
- EMAIL="librem5-builds@lists.community.puri.sm"
- dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG"
- debuild -i -us -uc -b
- cp ../*.deb .
build_deb:arm64:
tags:
- aarch64
- aarch64
stage: build
artifacts:
paths:
- "*.deb"
- '*.deb'
script:
- rm -f ../*.deb
- apt-get -y build-dep .
- apt-get -y install devscripts
- REV=$(git log -1 --format=%h)
- VER=$(dpkg-parsechangelog -SVersion)
- 'DEBFULLNAME="Librem5 CI" EMAIL="librem5-builds@lists.community.puri.sm" dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG"'
- debuild -i -us -uc -b
- cp ../*.deb .
- rm -f ../*.deb
- apt-get -y build-dep .
- apt-get -y install devscripts
- REV=$(git log -1 --format=%h)
- VER=$(dpkg-parsechangelog -SVersion)
- DEBFULLNAME="Librem5 CI"
- EMAIL="librem5-builds@lists.community.puri.sm"
- dch -v"$VER+librem5ci$CI_PIPELINE_ID.$REV" "$MSG"
- debuild -i -us -uc -b
- cp ../*.deb .
test_lintian:
stage: test

36
tools/yamlfmt Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Checks YAML files for correct formatting.
Usage: yamlfmt.py [--apply] file.yaml
"""
import ruamel.yaml
import sys
args = sys.argv[:]
try:
args.remove('--apply')
want_apply = True
except ValueError:
want_apply = False
path = args[1]
with open(path) as f:
contents = f.read()
yml = ruamel.yaml.round_trip_load(contents)
formatted = ruamel.yaml.round_trip_dump(yml, block_seq_indent=2)
well_formatted = formatted == contents
if not well_formatted:
print('The yaml file is not correctly formatted:', path)
if want_apply:
print('Correcting', path)
with open(path, 'w') as f:
f.write(formatted)
else:
print('Please use the following correction:')
print('----------corrected', path)
print(formatted)
print('----------end corrected', path)
sys.exit(1)