Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action #2

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
tags:
- '*'
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Check Scala formatting
run: sbt scalafmtCheckAll
- name: Run tests
run: sbt test

publish_docker:
needs: test
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
matrix:
app:
- azure
steps:
- name: Checkout Github
uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Set up JDK 11 for loader and streaming transformer
uses: actions/setup-java@v1
with:
java-version: 11
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Stage the Docker build
run: sbt "project ${{ matrix.app}}" docker:stage
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: "snowplow/lake-loader-${{ matrix.app }}"
tags: |
type=raw,value=latest,enable=${{ !contains(github.ref_name, 'rc') }}
type=raw,value=latest-focal,enable=${{ !contains(github.ref_name, 'rc') }}
type=raw,value=${{ github.ref_name }}
type=raw,value=${{ github.ref_name }}-focal
flavor: |
latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Push image
uses: docker/build-push-action@v2
with:
context: modules/${{ matrix.app }}/target/docker/stage
file: modules/${{ matrix.app }}/target/docker/stage/Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
push: true
- name: Build local image, which is needed to run Snyk
# if: ${{ !contains(github.ref_name, 'rc') }} # TODO: uncomment before final release
run: sbt "project ${{ matrix.app }}" docker:publishLocal
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/docker@master
# if: ${{ !contains(github.ref_name, 'rc') }} # TODO: uncomment before final release
with:
image: "snowplow/lake-loader-${{ matrix.app }}:${{ github.ref_name }}"
args: "--app-vulns --org=data-cap"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}