Update .github/workflows/main.yaml #2212
This file contains 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: CI | |
on: ["push"] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: | | |
git rev-list --count --first-parent HEAD > patch_version.txt | |
- uses: coursier/setup-action@v1 | |
with: | |
jvm: adopt:8 | |
- name: Set variables | |
run: | | |
IMAGE_REVISION=$(date +%Y-%m-%d)-$(git rev-parse --short HEAD) | |
BUILD_DATE=$(date +%Y-%m-%dT%H%M) | |
echo "DOCKER_IMAGE_NAME=eu.gcr.io/cognitedata/cdf-spark-performance-bench" >> $GITHUB_ENV | |
echo "DOCKER_IMAGE_TAG=$BUILD_DATE-$IMAGE_REVISION" >> $GITHUB_ENV | |
- name: Install SBT config and credentials | |
env: | |
SECRETS_KEY: ${{ secrets.SECRETS_KEY }} | |
run: | | |
mkdir -p ~/.sbt | |
./secrets/decrypt.sh secrets/repositories.gpg ~/.sbt/repositories | |
mkdir -p ~/.sbt/1.0 | |
./secrets/decrypt.sh secrets/credentials.sbt.gpg ~/.sbt/1.0/credentials.sbt | |
mkdir -p ~/.sbt/gpg | |
./secrets/decrypt.sh secrets/pubring.asc.gpg ~/.sbt/gpg/pubring.asc | |
./secrets/decrypt.sh secrets/secring.asc.gpg ~/.sbt/gpg/secring.asc | |
- name: Run tests | |
env: | |
TEST_CLIENT_ID_BLUEFIELD: ${{ secrets.BLUEFIELD_CLIENT_ID_2 }} | |
TEST_CLIENT_SECRET_BLUEFIELD: ${{ secrets.BLUEFIELD_CLIENT_SECRET_2 }} | |
TEST_AAD_TENANT_BLUEFIELD: ${{ secrets.TEST_AAD_TENANT_BLUEFIELD_2 }} | |
TEST_PROJECT: "spark-datasource-bluefield-tests" | |
TEST_CLUSTER: "bluefield.cognitedata.com" | |
run: | | |
TEST="test +Test/compile" | |
if [ ${{github.ref }} == "refs/heads/master" ]; then | |
TEST="+test" | |
fi | |
sbt -Dsbt.log.noformat=true scalastyle scalafmtCheck coverage $TEST coverageReport | |
- name: Upload Test Report | |
uses: actions/upload-artifact@v3 | |
if: always() # always run even if the previous step fails | |
with: | |
name: junit-test-results | |
path: 'target/test-reports/**/*.xml' | |
retention-days: 1 | |
- name: Upload report to codecov.io | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
- name: Build JAR file | |
run: | | |
LIB_PACKAGE="+library/package" | |
if [ ${{github.ref }} == "refs/heads/master" ]; then | |
LIB_PACKAGE="+fatJarShaded/assembly" | |
fi | |
sbt -Dsbt.log.noformat=true "set library/test := {}" $LIB_PACKAGE performancebench/docker:stage | |
- name: Deploy JAR | |
if: github.ref == 'refs/heads/master' | |
env: | |
SECRETS_KEY: ${{ secrets.SECRETS_KEY }} | |
run: | | |
./secrets/decrypt.sh secrets/gpg-key-password.gpg secrets/gpg-key-password | |
export GPG_KEY_PASSWORD=$(cat secrets/gpg-key-password) | |
sbt -Dsbt.log.noformat=true +fatJarShaded/publishSigned +structType/publishSigned +publishSigned sonatypeReleaseAll |