Skip to content

testing with docker actions #21

testing with docker actions

testing with docker actions #21

Workflow file for this run

name: ci
on:
push:
branches:
- '*'
- '*/*'
- '**'
jobs:
test:
name: Compile & Test
strategy:
matrix:
# Quotes are required: https://github.com/actions/setup-go/issues/326#issuecomment-1415719692
go-version: ['1.21.1']
os: [ubuntu-latest]
output-type: ['main', 'aws']
runs-on: ${{ matrix.os }}
env:
NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true
- name: Extract project version from file
id: version
run: |
echo ::set-output name=VERSION::"$(cat VERSION)"
- name: Block Concurrent Executions of Integration Tests
if: ${{ env.NGROK_TOKEN != '' }}
uses: softprops/turnstyle@v1
with:
poll-interval-seconds: 10
same-branch-only: false
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install ngrok
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip && unzip ngrok-stable-linux-amd64.zip -d $GITHUB_WORKSPACE/bin/
$GITHUB_WORKSPACE/bin/ngrok authtoken ${{ secrets.NGROK_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup integration resources
run: export NGROK_DIR=$GITHUB_WORKSPACE/bin/ && make integration-up
- name: Run integration & unit tests for amd64
run: make integration-test-amd64
- name: Run integration & unit tests for arm64
run: make integration-test-arm64
- name: Run linter
run: make lint
- name: Compile CLI
run: make cli
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
snowplow/snowbridge
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build main container image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.main
push: false
platforms: linux/amd64,linux/arm64
tags: ${{steps.version.outputs.VERSION}}
- name: Build AWS only container image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.aws
push: false
platforms: linux/amd64,linux/arm64
tags: ${{steps.version.outputs.VERSION}}-aws-only
- name: Snyk Setup
uses: snyk/actions/setup@master
- name: Run Snyk to check for vulnerabilities in main Docker image
run: snyk container test snowplow/snowbridge:${{steps.version.outputs.VERSION}} --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Run Snyk to check for vulnerabilities in aws-only Docker
run: snyk container test snowplow/snowbridge:${{steps.version.outputs.VERSION}}-aws-only --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Setup e2e resources
run: make e2e-up
- name: Run e2e tests
run: make e2e-test