Skip to content

Commit

Permalink
Merge pull request #223 from yetanalytics/ci_cd_improvements
Browse files Browse the repository at this point in the history
CI and CD improvements
  • Loading branch information
kelvinqian00 authored Apr 27, 2022
2 parents f82876f + 54a8a69 commit 02e5b20
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
45 changes: 34 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- id: echo-modules
run: echo "::set-output name=modules::$(cat .java_modules)"
outputs:
modules: ${{ steps.echo-modules.outputs.modules }}

build_jre:
needs: get_modules
uses: yetanalytics/runtimer/.github/workflows/runtimer.yml@3c6a902caaf0c6db272842055d9f8cca5cb3fcbc
with:
java-version: '11'
java-distribution: 'temurin'
java-modules: ${{ needs.get_modules.outputs.modules }}

build:
runs-on: ubuntu-latest
needs: build_jre
Expand Down Expand Up @@ -61,20 +64,44 @@ jobs:
unzip windows-2019-jre.zip -d target/bundle/runtimes
mv target/bundle/runtimes/windows-2019 target/bundle/runtimes/windows
# ARCHIVE BUNDLE - LABEL WITH COMMIT SHA OR TAG NAME
- name: Compress Bundle
run: | # Need to cd so that the zip file doesn't contain the parent dirs
cd target/bundle
zip -r ../../lrsql.zip ./
- name: Archive Bundle (Branch Pushes)
if: ${{ startsWith(github.ref, 'refs/heads') }}
if: ${{ github.ref_type == 'branch' }}
uses: actions/upload-artifact@v2
with:
name: lrsql-artifact-${{ github.sha }}
path: lrsql.zip

- name: Craft Draft Release (Tag Pushes)
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Archive Bundle (Tag Pushes)
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v2
with:
name: lrsql-artifact-${{ github.ref_name }}
path: lrsql.zip

release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_type == 'tag' }}
steps:
- uses: actions/checkout@v2

- name: Download Bundle Artifact
uses: actions/download-artifact@v2
with:
name: lrsql-artifact-${{ github.ref_name }}

- name: Unzip Bundle Artifact
run: |
mkdir -p target/bundle
unzip lrsql.zip -d target/bundle
- name: Craft Draft Release
uses: softprops/action-gh-release@v1
with:
# Defaults:
Expand All @@ -84,29 +111,25 @@ jobs:
draft: true
files: lrsql.zip

- name: Deploy Documentation (Tag Pushes)
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
branch: gh-pages
folder: target/bundle/doc

- name: Log in to Docker Hub (Tag Pushes)
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Extract metadata (tags, labels) for Docker (Tag Pushes)
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: yetanalytics/lrsql

- name: Build and push Docker image (Tag Pushes)
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/nvd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Periodic NVD Scan

on:
schedule:
- cron: '0 8 * * *' # Every day at 8:00 AM
- cron: '0 8 * * 1-5' # Every weekday at 8:00 AM

jobs:
nvd_scan:
Expand All @@ -11,3 +11,18 @@ jobs:
nvd-clojure-version: '2.0.0'
classpath-command: 'clojure -Spath -A:db-h2:db-sqlite:db-postgres'
nvd-config-filename: '.nvd/config.json'

notify_slack:
runs-on: ubuntu-latest
needs: nvd_scan
if: ${{ always() && (needs.nvd_scan.result == 'failure') }}
steps:
- name: Notify Slack SQL LRS NVD Scan Reporter
uses: slackapi/slack-github-action@v1.18.0
with:
payload: |
{
"run_link": "https://github.com/yetanalytics/lrsql/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 02e5b20

Please sign in to comment.