Skip to content

Commit

Permalink
Remove hard coded repo setting from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eloots committed Aug 29, 2023
1 parent b196ead commit 93c4377
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ permissions:

env:
EXERCISES_DIRECTORY: ./exercises
THIS_REPO: ${{ github.event.repository.name }}

jobs:
list-exercises:
Expand All @@ -34,7 +35,6 @@ jobs:
- 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
Expand All @@ -52,8 +52,12 @@ jobs:
cache: 'sbt'
distribution: 'temurin'

- name: Check code formatting
run: sbt scalafmtCheckAll
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}

- name: Test with sbt
run: sbt 'set scalaVersion := "3.0.0"' test
run: sbt test
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}

validate_course_summary:
Expand All @@ -76,14 +80,14 @@ jobs:
- name: Checkout Course Repo
uses: actions/checkout@v3
with:
path: cmt-template-scala3
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-RC10"
tag: "2.0.0"
fileName: "course-management-tools.zip"
out-file-path: "."
- run: |
Expand All @@ -99,23 +103,23 @@ jobs:
- name: Setup Coursier Cache
uses: coursier/[email protected]
with:
root: "cmt-template-scala3"
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 cmt-template-scala3 -d studentified
(cd studentified && exec zip -r cmt-template-scala3-student.zip cmt-template-scala3)
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 cmt-template-scala3 -d linearized
mv linearized/cmt-template-scala3 linearized/cmt-template-scala3-linearized
(cd linearized && exec zip -r cmt-template-scala3-linearized.zip cmt-template-scala3-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
Expand All @@ -134,18 +138,17 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # release created from previous step
asset_path: ./studentified/cmt-template-scala3-student.zip
asset_name: cmt-template-scala3-student.zip
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/cmt-template-scala3-linearized.zip
asset_name: cmt-template-scala3-linearized.zip
asset_path: ./linearized/${{ env.THIS_REPO }}-linearized.zip
asset_name: ${{ env.THIS_REPO }}-linearized.zip
asset_content_type: application/zip


0 comments on commit 93c4377

Please sign in to comment.