The tidy tool could be use to check the syntax of HTML files. To use it in your Gitlab CI pipeline add a tidy.config file to your projects root folder:
language: en
doctype: html5
drop-empty-elements: no
And the following job to .gitlab-ci.yml:
stage: test
tags:
- docker-runner
image: debian:stretch
script:
- apt-get update && apt-get install -y tidy
- find . -iregex ".*\.html?$" -print0 | xargs -0 -n1 -t tidy -config tidy.config -utf8 -errors
Make sure your Pipeline has a test stage and a docker runner is configured with the tag docker-runner.
For available configuration options check the tidy(1) man page.