Merge pull request #137 from crazy-max/update-syft #260
This file contains hidden or 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: e2e | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
pull_request: | |
env: | |
BUILDX_VERSION: latest | |
BUILDKIT_IMAGE: moby/buildkit:v0.22.0 # FIXME: Update to the latest version once https://github.com/moby/buildkit/issues/6049 is fixed | |
IMAGE_LOCAL: localhost:5000/buildkit-syft-scanner:latest | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.examples.outputs.matrix }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Create matrix | |
id: examples | |
run: | | |
examples=$(jq -ncR '[inputs]' <<< "$(ls -A ./examples/)") | |
echo "matrix=$examples" >> $GITHUB_OUTPUT | |
- | |
name: Show matrix | |
run: | | |
echo ${{ steps.examples.outputs.matrix }} | |
test: | |
runs-on: ubuntu-latest | |
needs: | |
- prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
example: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.24" | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: ${{ env.BUILDX_VERSION }} | |
driver-opts: | | |
network=host | |
image=${{ env.BUILDKIT_IMAGE }} | |
- | |
name: Build and push Syft Scanner image | |
uses: docker/bake-action@v6 | |
with: | |
targets: image-local | |
push: true | |
- | |
name: Test | |
run: | | |
./hack/check-example.sh ${{ env.IMAGE_LOCAL }} ${{ matrix.example }} | |
- | |
name: Check output folder | |
run: | | |
tree ./examples/${{ matrix.example }}/build | |
- | |
name: Print SBOM | |
if: matrix.example != 'scratch' | |
run: | | |
jq . ./examples/${{ matrix.example }}/build/sbom-base.spdx.json | |
- | |
name: Upload output folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: e2e-${{ matrix.example }} | |
path: ./examples/${{ matrix.example }}/build/* | |
if-no-files-found: error |