mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-24 03:58:12 -08:00
124 lines
2.8 KiB
YAML
124 lines
2.8 KiB
YAML
name: Test
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
- 'LICENSE'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
- 'LICENSE'
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.operating-system }}
|
|
strategy:
|
|
matrix:
|
|
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: oldstable
|
|
|
|
- name: go mod tidy
|
|
run: |
|
|
go mod tidy
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
echo "Run 'go mod tidy' and push it"
|
|
exit 1
|
|
fi
|
|
if: matrix.operating-system == 'ubuntu-latest'
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v3.4.0
|
|
with:
|
|
version: v1.49
|
|
args: --deadline=30m
|
|
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
|
|
if: matrix.operating-system == 'ubuntu-latest'
|
|
|
|
# Install tools
|
|
- uses: aquaproj/aqua-installer@v2.0.2
|
|
with:
|
|
aqua_version: v1.25.0
|
|
|
|
- name: Run unit tests
|
|
run: make test
|
|
|
|
integration:
|
|
name: Integration Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run integration tests
|
|
run: make test-integration
|
|
|
|
module-test:
|
|
name: Module Integration Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
# Install tools
|
|
- uses: aquaproj/aqua-installer@v2.0.2
|
|
with:
|
|
aqua_version: v1.25.0
|
|
|
|
- name: Run module integration tests
|
|
shell: bash
|
|
run: |
|
|
make test-module-integration
|
|
|
|
build-test:
|
|
name: Build Test
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Show available Docker Buildx platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v4
|
|
with:
|
|
version: v1.4.1
|
|
args: release --skip-sign --snapshot --rm-dist --skip-publish --timeout 90m
|
|
|