Skip to content

Commit

Permalink
setup CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
marclamy committed Apr 10, 2024
1 parent d92c1af commit 0cc6f51
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "CI"

on:
push:
branches: [ "main" ]
paths-ignore: ["docs/**", "**/README.md", "**/CODE_OF_CONDUCT.md", "**/CONTRIBUTING.md", "**/LICENSE"]
pull_request:
branches: ["main"]
paths-ignore: ["docs/**", "**/README.md", "**/CODE_OF_CONDUCT.md", "**/CONTRIBUTING.md", "**/LICENSE"]
types:
- opened
- reopened
- synchronize
workflow_dispatch:
inputs:
spark-version:
description: 'Spark version for the build (SemVer)'
required: true

jobs:
spark_versions_validation:
if: ${{ github.event_name != 'workflow_dispatch' }}
strategy:
matrix:
spark_version: ['3.2.4', '3.3.2', '3.4.1']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: "temurin"
cache: "sbt"
- env:
SPARK_VERSION_OVERRIDE: ${{ matrix.spark_version }}
run: |
echo "$SPARK_VERSION_OVERRIDE" > project/spark-version.conf
- run: cat project/spark-version.conf
- run: sbt compile
- run: sbt test

build:
runs-on: ubuntu-latest
env:
SPARK_VERSION_OVERRIDE: ${{ inputs.spark-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: "temurin"
cache: "sbt"
- if: ${{ env.SPARK_VERSION_OVERRIDE != '' }}
run: echo "$SPARK_VERSION_OVERRIDE" > project/spark-version.conf
- run: sbt compile
- run: sbt test
- run: sbt package
- run: tar cf artefacts.tar target/scala-*/*.jar */target/scala-*/*.jar
- uses: actions/[email protected]
with:
name: Artefacts
path: artefacts.tar

run-name: ${{ github.event_name == 'workflow_dispatch' && format('Building for Spark {0}', inputs.spark-version) || ' '}}
69 changes: 69 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Documentation (build and deploy)

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths: ["docs/**"]
pull_request:
branches: ["main"]
paths: ["docs/**"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
working-directory: '${{ github.workspace }}/docs'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v1
with:
path: "docs/_site/"

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish

on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (SemVer)'
type: string
required: true

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
env:
VERSION: ${{ inputs.version }}
GITHUB_REGISTRY_TOKEN: ${{ secrets.TOKEN }}
steps:
- uses: actions/checkout@v4
- run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: "temurin"
cache: "sbt"
- run: sbt "release release-version ${VERSION} with-defaults"

run-name: ${{ format('Publishing version {0}', inputs.version) }}

0 comments on commit 0cc6f51

Please sign in to comment.