mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-24 03:58:12 -08:00
138 lines
3.3 KiB
YAML
138 lines
3.3 KiB
YAML
name: Test
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '*.md'
|
|
- 'docs/**'
|
|
- 'mkdocs.yml'
|
|
- 'LICENSE'
|
|
pull_request:
|
|
env:
|
|
GO_VERSION: "1.18"
|
|
TINYGO_VERSION: "0.23.0"
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: go mod tidy
|
|
run: |
|
|
go mod tidy
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v3.2.0
|
|
with:
|
|
version: v1.45
|
|
args: --deadline=30m
|
|
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778
|
|
|
|
- name: Install TinyGo
|
|
run: |
|
|
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
|
|
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
|
|
|
|
- name: Run unit tests
|
|
run: make test
|
|
|
|
integration:
|
|
name: Integration Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Run integration tests
|
|
run: make test-integration
|
|
|
|
module-test:
|
|
name: Module Integration Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
id: go
|
|
|
|
- name: Install TinyGo
|
|
run: |
|
|
wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb
|
|
sudo dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Run module integration tests
|
|
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: ${{ env.GO_VERSION }}
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v3
|
|
with:
|
|
version: v1.4.1
|
|
args: release --snapshot --rm-dist --skip-publish --timeout 60m
|
|
|
|
build-documents:
|
|
name: Documentation Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: true
|
|
- uses: actions/setup-python@v3
|
|
with:
|
|
python-version: 3.x
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r docs/build/requirements.txt
|
|
- name: Configure the git user
|
|
run: |
|
|
git config user.name "knqyf263"
|
|
git config user.email "knqyf263@gmail.com"
|
|
- name: Deploy the dev documents
|
|
run: mike deploy test
|