diff --git a/.github/workflows/go_build.yaml b/.github/workflows/go_build.yaml index 4a6218b..8ddb18f 100644 --- a/.github/workflows/go_build.yaml +++ b/.github/workflows/go_build.yaml @@ -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 id: go - name: Check out code @@ -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 - name: Get dependencies - run: | - go mod download - - name: Build - run: | - go build ./... + run: go mod download - - name: Spec Test Coverage - run: | - go run tests/spectests/cmd/analyzer/analyzer.go \ No newline at end of file + - 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```' + }); \ No newline at end of file