Version Comparison #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Version Comparison | |
on: | |
workflow_dispatch: | |
inputs: | |
baseRef: | |
description: 'Base CLI ref (tag/branch/SHA)' | |
baseRulesRef: | |
description: 'Base rules ref' | |
testRef: | |
description: 'Test CLI ref (tag/branch/SHA)' | |
testRulesRef: | |
description: 'Test rules ref' | |
jobs: | |
setup: | |
name: Setup version comparison | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.load_json.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: load_json | |
run : | | |
echo "matrix=$(npx --yes json5 ./kpi_scan/kpi_repo_list.json5)" >> $GITHUB_OUTPUT | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21 | |
- name: Checkout base CLI | |
uses: actions/checkout@v4 | |
with: | |
repository: bearer/bearer | |
ref: ${{ inputs.baseRef }} | |
path: base-cli | |
- name: Checkout base rules | |
uses: actions/checkout@v4 | |
with: | |
repository: bearer/bearer-rules | |
ref: ${{ inputs.baseRulesRef }} | |
path: base-rules | |
- name: Build base CLI | |
run: | | |
cd ./base-cli | |
go build -o ../base-bearer ./cmd/bearer/main.go | |
- name: Checkout test CLI | |
uses: actions/checkout@v4 | |
with: | |
repository: bearer/bearer-rules | |
ref: ${{ inputs.testRef }} | |
path: test-cli | |
- name: Checkout test rules | |
uses: actions/checkout@v4 | |
with: | |
repository: bearer/bearer-rules | |
ref: ${{ inputs.testRulesRef }} | |
path: test-rules | |
- name: Build test CLI | |
run: | | |
cd ./test-cli | |
go build -o ../test-bearer ./cmd/bearer/main.go | |
test: | |
needs: [setup] | |
name: Run version comparison scans for ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.setup.outputs.matrix)}} | |
steps: | |
- name: Checkout KPI repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.repository_url }} | |
path: ${{ matrix.name }} | |
- run: | | |
./base-bearer scan ${{ matrix.name }} --format json --exit-code 0 | jq > base.json | |
- run: | | |
./test-bearer scan ${{ matrix.name }} --format json --exit-code 0 | jq > test.json | |
- run: | | |
diff -u base.json test.json | |