Add license headers to ITs (#884) #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration tests | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
GIT_REF: | |
description: 'Commit hash to run the tests' | |
required: true | |
jobs: | |
build-quesma-docker-image: | |
uses: ./.github/workflows/build-quesma-docker-image.yml | |
with: | |
REF: ${{inputs.GIT_REF}} | |
integration-test-run: | |
runs-on: ubuntu-latest | |
needs: [build-quesma-docker-image] | |
steps: | |
- uses: actions/checkout@v4 | |
with: ## @TODO REMOVE | |
ref: ${{ github.event.inputs.GIT_REF }} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
cache-dependency-path: smoke-test/go.sum | |
go-version: '1.23' | |
- name: Download images | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/images | |
- name: Load images | |
run: | | |
for file in /tmp/images/*/*.tar; do | |
docker load --input $file | |
done | |
docker image ls -a | |
- name: Set environment variable | |
run: echo "EXECUTING_ON_GITHUB_CI=true" >> $GITHUB_ENV | |
- name: Get last commit author | |
id: get_author | |
run: echo "::set-output name=author::$(git log -1 --pretty=format:'%an <%ae> sha1={%H}')" | |
- name: License Header Verification | |
working-directory: ci/it | |
run: | | |
LICENSE_COMMENT="// Copyright Quesma, licensed under the Elastic License 2.0. | |
// SPDX-License-Identifier: Elastic-2.0" | |
failed=false | |
while IFS= read -r -d '' file; do | |
file_content=$(< "$file") | |
if [[ "$file_content" != "$LICENSE_COMMENT"* ]]; then | |
echo "License header missing or incorrect in file: $file" | |
failed=true | |
fi | |
done < <(find . -type f -name "*.go" -print0) | |
if [ "$failed" = true ]; then | |
exit 1 | |
fi | |
- name: Run integration tests | |
working-directory: ci/it | |
run: go test -v | |
- name: Send Slack notification on failure | |
if: failure() | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | |
slack-message: | | |
:exclamation: *Integration tests failed.* :exclamation: <!channel> | |
Last commit by: ${{ steps.get_author.outputs.author }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Send Slack notification on success | |
if: success() | |
uses: slackapi/[email protected] | |
with: | |
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | |
slack-message: | | |
:white_check_mark: *Integration tests passed.* Good job team! | |
Last commit by: ${{ steps.get_author.outputs.author }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |