Skip to content

Commit 404d180

Browse files
committed
ci: Add license checker to CI pipeline.
1 parent 7aa1bcd commit 404d180

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

.gitlab-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ spotless:
3030
stage: check
3131
script: ./gradlew spotlessCheck
3232

33+
licenseCheck:
34+
stage: check
35+
script:
36+
- ./license_checker.sh '*.java' | tee license_check_output.txt
37+
- '[ ! -s license_check_output.txt ]'
38+
3339
# stage: build ----------------------
3440

3541
build:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
### Added
9+
* Script to check our source code for license headers and a step for them in the CI.
10+
711
## [1.1.0] - 2023-01-26
812
### Added
913
* Add example maven project using this library.
@@ -71,6 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7175
Initial version.
7276

7377

78+
[Unreleased]: https://github.com/DeepLcom/deepl-java/compare/v1.1.0...HEAD
7479
[1.1.0]: https://github.com/DeepLcom/deepl-java/compare/v1.0.1...v1.1.0
7580
[1.0.1]: https://github.com/DeepLcom/deepl-java/compare/v1.0.0...v1.0.1
7681
[1.0.0]: https://github.com/DeepLcom/deepl-java/compare/v0.2.1...v1.0.0

license_checker.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# Usage: ./license_checker.sh source_code_pattern
4+
# Example: ./license_checker.sh '*.py'
5+
# This will search all .py files, ignoring anything not tracked in your git tree
6+
7+
git ls-files -z $1 | xargs -0 -I{} sh -c 'RES=$(head -n 3 "{}" | grep "Copyright 20[0-9][0-9] DeepL SE (https://www.deepl.com)"); if [ ! "${RES}" ] ; then echo "Lacking copyright header in" "{}" ; fi'

0 commit comments

Comments
 (0)