1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- name : go_test
16- on : [push, pull_request]
17- jobs :
15+ name : CQL Testing and Analysis
16+ on : [push, pull_request, workflow_dispatch]
1817
18+ jobs :
1919 go_test :
2020 runs-on : ${{ matrix.os }}
2121 strategy :
2222 matrix :
2323 os : [ubuntu-latest, macOS-latest, windows-latest]
2424 steps :
25-
2625 - name : Set up Go 1.22
2726 uses : actions/setup-go@v5
2827 with :
2928 go-version : 1.22
29+ cache : true
3030 id : go
3131
3232 - name : Check out code
@@ -44,28 +44,44 @@ jobs:
4444 go test ./...
4545
4646 go_spec_test_coverage :
47- runs-on : ${{ matrix.os }}
48- strategy :
49- matrix :
50- os : [ubuntu-latest]
47+ runs-on : ubuntu-latest
5148 steps :
49+ - name : Check out code
50+ uses : actions/checkout@v4
5251
5352 - name : Set up Go 1.22
5453 uses : actions/setup-go@v5
5554 with :
5655 go-version : 1.22
57- id : go
58-
59- - name : Check out code
60- uses : actions/checkout@v4
56+ cache : true
6157
6258 - name : Get dependencies
63- run : |
64- go mod download
65- - name : Build
66- run : |
67- go build ./...
59+ run : go mod download
6860
69- - name : Spec Test Coverage
70- run : |
71- go run tests/spectests/cmd/analyzer/analyzer.go
61+ - name : Build analyzer
62+ run : go build -o analyzer tests/spectests/cmd/analyzer/analyzer.go
63+
64+ - name : Run analyzer
65+ run : ./analyzer > analyzer-output.txt
66+
67+ - name : Upload analyzer results
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : analyzer-results
71+ path : analyzer-output.txt
72+ if-no-files-found : error
73+
74+ - name : Comment PR with analyzer results
75+ if : github.event_name == 'pull_request'
76+ uses : actions/github-script@v7
77+ with :
78+ script : |
79+ const fs = require('fs');
80+ const analyzerOutput = fs.readFileSync('analyzer-output.txt', 'utf8');
81+
82+ github.rest.issues.createComment({
83+ issue_number: context.issue.number,
84+ owner: context.repo.owner,
85+ repo: context.repo.repo,
86+ body: '## CQL Test Analyzer Results\n\n```\n' + analyzerOutput + '\n```'
87+ });
0 commit comments