Skip to content

Potential fix for pull request finding #6226

Potential fix for pull request finding

Potential fix for pull request finding #6226

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
unit-test:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-unit-test
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Report Go cache status
run: |
if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then
echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY
fi
- name: Verify dependencies
run: go mod verify
- name: Run unit tests with coverage
run: |
make test-ci
go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-report
path: coverage.html
retention-days: 7
- name: Upload unit test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-result-unit
path: test-result-unit.json
retention-days: 14
lint:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-lint
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Report Go cache status
run: |
if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then
echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY
fi
- name: Run go vet and gofmt checks
run: make lint
- name: Run golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2
install-mode: goinstall
args: --timeout=5m
verify: false
integration-test:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-integration-test
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Report Go cache status
run: |
if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then
echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY
fi
- name: Build binary
run: make build
- name: Run binary integration tests
run: make test-integration
- name: Upload build artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: awmg-binary
path: awmg
retention-days: 7
rust-guard-test:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-rust-guard-test
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache-workspaces: guards/github-guard/rust-guard
- name: Run Rust guard unit tests
working-directory: guards/github-guard/rust-guard
run: cargo test --lib
race-test:
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-race-test
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache: true
- name: Report Go cache status
run: |
if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then
echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY
fi
- name: Run unit tests with race detection
run: make test-race
smoke-copilot-pr:
runs-on: ubuntu-latest
needs: [unit-test, lint, integration-test, rust-guard-test]
if: github.event_name == 'pull_request'
permissions:
actions: write
contents: read
steps:
- name: Trigger smoke-copilot workflow for PR
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'smoke-copilot.lock.yml',
ref: context.payload.pull_request.head.ref
});
console.log('✓ Triggered smoke-copilot workflow for PR');
smoke-copilot:
runs-on: ubuntu-latest
needs: [unit-test, lint, integration-test, rust-guard-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
actions: write
steps:
- name: Trigger smoke-copilot workflow
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'smoke-copilot.lock.yml',
ref: 'main'
});
console.log('✓ Triggered smoke-copilot workflow');
large-payload-tester:
runs-on: ubuntu-latest
needs: [unit-test, lint, integration-test, rust-guard-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
actions: write
steps:
- name: Trigger large-payload-tester workflow
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'large-payload-tester.lock.yml',
ref: 'main'
});
console.log('✓ Triggered large-payload-tester workflow');
language-support-tester:
runs-on: ubuntu-latest
needs: [unit-test, lint, integration-test, rust-guard-test]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
actions: write
steps:
- name: Trigger language-support-tester workflow
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'language-support-tester.lock.yml',
ref: 'main'
});
console.log('✓ Triggered language-support-tester workflow');