Skip to content

Grafana Dashboard

Grafana Dashboard #199

Workflow file for this run

name: Scala Course CI
on:
push:
tags: '*'
paths-ignore:
- 'README.md'
- '**/README.md'
- 'slides/**'
- 'scripts/**'
branches: [ main ]
pull_request:
paths-ignore:
- 'README.md'
- '**/README.md'
- 'slides/**'
- 'scripts/**'
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
env:
EXERCISES_DIRECTORY: ./exercises
THIS_REPO: ${{ github.event.repository.name }}
jobs:
list-exercises:
runs-on: ubuntu-latest
outputs:
exercises: ${{steps.list.outputs.exercises}}
steps:
- uses: actions/checkout@v3
- id: list
run: echo "::set-output name=exercises::$(ls $EXERCISES_DIRECTORY | grep exercise_ | jq -cnR '[inputs | select(length>0)]')"
# run: echo "name=exercises::$(ls $EXERCISES_DIRECTORY | grep exercise_ | jq -cnR '[inputs | select(length>0)]')" >> $GITHUB_OUTPUT
validate_course:
runs-on: ubuntu-latest
needs: list-exercises
strategy:
fail-fast: false
matrix:
exercise: ${{fromJson(needs.list-exercises.outputs.exercises)}}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
cache: 'sbt'
distribution: 'temurin'
- name: Check code formatting
run: sbt scalafmtCheckAll
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}
- name: Test with sbt
run: sbt test
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}
validate_course_summary:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: validate_course
steps:
- name: Check build matrix status
if: ${{ needs.validate_course.result != 'success' }}
run: exit 1
create_release:
runs-on: ubuntu-latest
needs: [validate_course]
# Release gets triggered only on creating new tags
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
steps:
- name: Checkout Course Repo
uses: actions/checkout@v3
with:
path: ${{ env.THIS_REPO }}
fetch-depth: 0
- name: Setup Course Management Tools
uses: robinraju/[email protected]
with:
repository: lunatech-labs/course-management-tools
tag: "2.0.0"
fileName: "course-management-tools.zip"
out-file-path: "."
- run: |
unzip course-management-tools.zip
echo "$GITHUB_WORKSPACE/course-management-tools/bin" >> $GITHUB_PATH
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Setup Coursier Cache
uses: coursier/[email protected]
with:
root: ${{ env.THIS_REPO }}
- name: Studentify Repo
run: |
mkdir -p studentified
export PATH=${PATH}:$GITHUB_WORKSPACE/CMT/bin
git config --global user.email "[email protected]"
git config --global user.name "Lunatech Labs"
cmta studentify -f -g -m ${{ env.THIS_REPO }} -d studentified
(cd studentified && exec zip -r ${{ env.THIS_REPO }}-student.zip ${{ env.THIS_REPO }})
- name: Linearize Repo
run: |
mkdir -p linearized
cmta linearize -f -m ${{ env.THIS_REPO }} -d linearized
mv linearized/${{ env.THIS_REPO }} linearized/${{ env.THIS_REPO }}-linearized
(cd linearized && exec zip -r ${{ env.THIS_REPO }}-linearized.zip ${{ env.THIS_REPO }}-linearized)
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Studentified repo to Github release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # release created from previous step
asset_path: ./studentified/${{ env.THIS_REPO }}-student.zip
asset_name: ${{ env.THIS_REPO }}-student.zip
asset_content_type: application/zip
- name: Upload Linearized repo to Github release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # release created from previous step
asset_path: ./linearized/${{ env.THIS_REPO }}-linearized.zip
asset_name: ${{ env.THIS_REPO }}-linearized.zip
asset_content_type: application/zip