forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (94 loc) · 5.48 KB
/
sql-test-workflow.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
96
97
98
99
100
101
102
103
name: SQL Plugin Tests
on:
workflow_dispatch:
inputs:
name:
required: false
type: string
run-name:
${{ inputs.name == '' && format('{0} @ {1}', github.ref_name, github.sha) || inputs.name }}
jobs:
Get-CI-Image-Tag:
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
with:
product: opensearch
build:
needs: Get-CI-Image-Tag
strategy:
matrix:
java:
- 21
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Run tests
id: tests
run: |
chown -R 1000:1000 `pwd`
# Spotless
su `id -un 1000` -c './gradlew :opensearch:spotlessCheck || echo "* Spotless failed for opensearch" > report.log'
su `id -un 1000` -c './gradlew :sql:spotlessCheck || echo "* Spotless failed for sql" >> report.log'
su `id -un 1000` -c './gradlew :ppl:spotlessCheck || echo "* Spotless failed for ppl" >> report.log'
su `id -un 1000` -c './gradlew :core:spotlessCheck || echo "* Spotless failed for core" >> report.log'
su `id -un 1000` -c './gradlew :common:spotlessCheck || echo "* Spotless failed for common" >> report.log'
su `id -un 1000` -c './gradlew :legacy:spotlessCheck || echo "* Spotless failed for legacy" >> report.log'
su `id -un 1000` -c './gradlew :protocol:spotlessCheck || echo "* Spotless failed for protocol" >> report.log'
su `id -un 1000` -c './gradlew :opensearch-sql-plugin:spotlessCheck || echo "* Spotless failed for plugin" >> report.log'
su `id -un 1000` -c './gradlew :integ-test:spotlessCheck || echo "* Spotless failed for integ-test" >> report.log'
# Unit tests
su `id -un 1000` -c './gradlew :opensearch:test || echo "* Unit tests failed for opensearch" >> report.log'
su `id -un 1000` -c './gradlew :ppl:test || echo "* Unit tests failed for sql" >> report.log'
su `id -un 1000` -c './gradlew :sql:test || echo "* Unit tests failed for ppl" >> report.log'
su `id -un 1000` -c './gradlew :core:test || echo "* Unit tests failed for core" >> report.log'
su `id -un 1000` -c './gradlew :protocol:test || echo "* Unit tests failed for protocol" >> report.log'
su `id -un 1000` -c './gradlew :opensearch-sql-plugin:test || echo "* Unit tests failed for plugin" >> report.log'
su `id -un 1000` -c './gradlew :legacy:test || echo "* Unit tests failed for legacy" >> report.log'
# jacoco
su `id -un 1000` -c './gradlew :opensearch:jacocoTestCoverageVerification || echo "* Jacoco failed for opensearch" >> report.log'
su `id -un 1000` -c './gradlew :ppl:jacocoTestCoverageVerification || echo "* Jacoco failed for sql" >> report.log'
su `id -un 1000` -c './gradlew :sql:jacocoTestCoverageVerification || echo "* Jacoco failed for ppl" >> report.log'
su `id -un 1000` -c './gradlew :core:jacocoTestCoverageVerification || echo "* Jacoco failed for core" >> report.log'
su `id -un 1000` -c './gradlew :protocol:jacocoTestCoverageVerification || echo "* Jacoco failed for protocol" >> report.log'
su `id -un 1000` -c './gradlew :opensearch-sql-plugin:jacocoTestCoverageVerification || echo "* Jacoco failed for plugin" >> report.log'
# Misc tests
su `id -un 1000` -c './gradlew :integ-test:integTest || echo "* Integration test failed" >> report.log'
su `id -un 1000` -c './gradlew :doctest:doctest || echo "* Doctest failed" >> report.log'
su `id -un 1000` -c './scripts/bwctest.sh || echo "* Backward compatibility test failed" >> report.log'
- name: Verify test results
run: |
if [[ -e report.log ]]
then
echo "## FAILED TESTS :facepalm::warning::bangbang:" >> $GITHUB_STEP_SUMMARY
cat report.log >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.entry.java }}
path: |
sql/build/reports/**
ppl/build/reports/**
core/build/reports/**
common/build/reports/**
opensearch/build/reports/**
integ-test/build/reports/**
protocol/build/reports/**
legacy/build/reports/**
plugin/build/reports/**
doctest/build/testclusters/docTestCluster-0/logs/*
integ-test/build/testclusters/*/logs/*