diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a9e31d2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: ci-components + +on: + pull_request: + push: + branches: + - master + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + env: + SOURCE_PATH: project + steps: + - name: checkout repository + uses: actions/checkout@v4 + with: + path: ${{ env.SOURCE_PATH }} + + - name: check license headers + env: + CI_COMPONENTS_PATH: ${{ env.SOURCE_PATH }} + PROJECT_PATH: ${{ env.SOURCE_PATH }} + shell: bash + run: | + ${{ ENV.SOURCE_PATH }}/scripts/fmt/check_license.sh diff --git a/scripts/fmt/check_license.sh b/scripts/fmt/check_license.sh index 7548126..b96bbcd 100755 --- a/scripts/fmt/check_license.sh +++ b/scripts/fmt/check_license.sh @@ -2,6 +2,16 @@ set -xe +if [[ -z "$PROJECT_PATH" ]]; then + echo "Error: PROJECT_PATH is missed or empty" + exit 1 +fi + +if [[ -z "$CI_COMPONENTS_PATH" ]]; then + echo "Error: CI_COMPONENTS_PATH is missed or empty" + exit 1 +fi + output=$("$CI_COMPONENTS_PATH"/scripts/fmt/verify_license.py --path "$PROJECT_PATH" 2>&1 || exit 1) if [ -n "$output" ]; then echo "Error: Some files are missing the Apache 2.0 license header:"