-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (83 loc) · 3.23 KB
/
integration-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 "author=$(git log -1 --pretty=format:'%an <%ae>, commit URL: ${{ github.server_url }}/${{ github.repository }}/commit/%H')" >> $GITHUB_OUTPUT
- 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() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
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 }}
*Workflow run URL:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Send Slack notification on success
if: ${{ success() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
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 }}
*Workflow run URL:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}