Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 36 additions & 20 deletions .github/workflows/go_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: go_test
on: [push, pull_request]
jobs:
name: CQL Testing and Analysis
on: [push, pull_request, workflow_dispatch]

jobs:
go_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:

- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe from reading https://github.com/actions/setup-go?tab=readme-ov-file that we don't need to explicitly add caching for this action, since as of v4 caching is the default behavior.

id: go

- name: Check out code
Expand All @@ -44,28 +44,44 @@ jobs:
go test ./...

go_spec_test_coverage:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: 1.22
id: go

- name: Check out code
uses: actions/checkout@v4
cache: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above comment, seems like this is unneeded.


- name: Get dependencies
run: |
go mod download
- name: Build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuine question, does this work? don't we still need to build everything for the analyzer to be able to run?

run: |
go build ./...
run: go mod download

- name: Spec Test Coverage
run: |
go run tests/spectests/cmd/analyzer/analyzer.go
- name: Build analyzer
run: go build -o analyzer tests/spectests/cmd/analyzer/analyzer.go

- name: Run analyzer
run: ./analyzer > analyzer-output.txt

- name: Upload analyzer results
uses: actions/upload-artifact@v4
with:
name: analyzer-results
path: analyzer-output.txt
if-no-files-found: error

- name: Comment PR with analyzer results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const analyzerOutput = fs.readFileSync('analyzer-output.txt', 'utf8');

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## CQL Test Analyzer Results\n\n```\n' + analyzerOutput + '\n```'
});