Skip to content

Add DIFC labeling rule for create_pull_request_with_copilot (#3651) #1916

Add DIFC labeling rule for create_pull_request_with_copilot (#3651)

Add DIFC labeling rule for create_pull_request_with_copilot (#3651) #1916

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '.github/workflows/ci.yml'
- 'guards/**'
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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Set up Go
id: setup-go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: coverage-report
path: coverage.html
retention-days: 7
- name: Upload unit test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Set up Go
id: setup-go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
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@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
with:
version: v2.8.0
args: --timeout=5m
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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Set up Go
id: setup-go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@a0b538fa0b742a6aa35d6e2c169b4bd06d225a98 # v1.15.3
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
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@v7
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@v7
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@v7
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@v7
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');