Audit SCA recursive scan #2330
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: "Go Tests" | |
on: | |
push: | |
# Triggers the workflow on labeled PRs only. | |
pull_request_target: | |
types: [labeled] | |
# Ensures that only the latest commit is running for each PR at a time. | |
# Ignores this rule for push events. | |
concurrency: | |
group: ${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
Pretest: | |
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Unlabel 'safe to test' | |
uses: actions-ecosystem/action-remove-labels@v1 | |
if: ${{ github.event_name != 'push' }} | |
with: | |
labels: "safe to test" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.x | |
- name: Go Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
# Generate mocks | |
- name: Generate mocks | |
run: go generate ./... | |
- name: Lint | |
run: go vet -v ./... | |
tests: | |
needs: Pretest | |
name: ${{ matrix.suite.name }} Tests (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
JFROG_CLI_LOG_LEVEL: "DEBUG" | |
strategy: | |
fail-fast: false | |
matrix: | |
suite: | |
- name: 'Unit' | |
- name: 'Scan Repository' | |
package: 'scanrepository' | |
- name: 'Scan Pull Request' | |
package: 'scanpullrequest' | |
- name: 'Package Handlers' | |
package: 'packagehandlers' | |
os: [ ubuntu, windows, macos ] | |
steps: | |
# Configure prerequisites | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.x | |
- name: Go Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Setup Python3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install python components | |
run: python -m pip install pipenv poetry | |
- name: Install dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "6.x" | |
# Generate mocks | |
- name: Generate mocks | |
run: go generate ./... | |
if: ${{ matrix.suite.name != 'Unit' }} | |
- name: Run Tests | |
run: go test github.com/jfrog/frogbot/${{ matrix.suite.package }} -v -race -timeout 30m -cover | |
env: | |
JF_URL: ${{ secrets.PLATFORM_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} | |
integration-tests: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Build Frogbot | |
run: buildscripts/build.sh | |
- name: Run GitHub Integration Tests | |
run: go test -v github_test.go integrationutils.go main.go commands.go -race -timeout 30m -cover | |
env: | |
JF_URL: ${{ secrets.PLATFORM_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.PLATFORM_ADMIN_TOKEN }} | |
FROGBOT_TESTS_GITHUB_TOKEN: ${{ secrets.FROGBOT_TESTS_GITHUB_TOKEN }} | |
# Build and run frogbot current changes for visual sanity check. | |
sanity-pull-request: | |
needs: tests | |
if: ${{ github.event_name != 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.x | |
- name: Build Frogbot | |
run: buildscripts/build.sh | |
- name: Scan | |
env: | |
JF_URL: ${{ secrets.FROGBOT_URL }} | |
JF_ACCESS_TOKEN: ${{ secrets.FROGBOT_ACCESS_TOKEN }} | |
JF_GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
JF_GIT_PULL_REQUEST_ID: ${{ github.event.number }} | |
JF_GIT_PROVIDER: "github" | |
JF_GIT_OWNER: ${{ github.repository_owner }} | |
JF_GIT_REPO: ${{ github.event.repository.name }} | |
run: ./frogbot scan-pull-request |