Skip to content

Commit 93c4377

Browse files
committed
Remove hard coded repo setting from CI
1 parent b196ead commit 93c4377

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ permissions:
2424

2525
env:
2626
EXERCISES_DIRECTORY: ./exercises
27+
THIS_REPO: ${{ github.event.repository.name }}
2728

2829
jobs:
2930
list-exercises:
@@ -34,7 +35,6 @@ jobs:
3435
- uses: actions/checkout@v3
3536
- id: list
3637
run: echo "::set-output name=exercises::$(ls $EXERCISES_DIRECTORY | grep exercise_ | jq -cnR '[inputs | select(length>0)]')"
37-
# run: echo "name=exercises::$(ls $EXERCISES_DIRECTORY | grep exercise_ | jq -cnR '[inputs | select(length>0)]')" >> $GITHUB_OUTPUT
3838

3939
validate_course:
4040
runs-on: ubuntu-latest
@@ -52,8 +52,12 @@ jobs:
5252
cache: 'sbt'
5353
distribution: 'temurin'
5454

55+
- name: Check code formatting
56+
run: sbt scalafmtCheckAll
57+
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}
58+
5559
- name: Test with sbt
56-
run: sbt 'set scalaVersion := "3.0.0"' test
60+
run: sbt test
5761
working-directory: ${{env.EXERCISES_DIRECTORY}}/${{matrix.exercise}}
5862

5963
validate_course_summary:
@@ -76,14 +80,14 @@ jobs:
7680
- name: Checkout Course Repo
7781
uses: actions/checkout@v3
7882
with:
79-
path: cmt-template-scala3
83+
path: ${{ env.THIS_REPO }}
8084
fetch-depth: 0
8185

8286
- name: Setup Course Management Tools
8387
uses: robinraju/[email protected]
8488
with:
8589
repository: lunatech-labs/course-management-tools
86-
tag: "2.0.0-RC10"
90+
tag: "2.0.0"
8791
fileName: "course-management-tools.zip"
8892
out-file-path: "."
8993
- run: |
@@ -99,23 +103,23 @@ jobs:
99103
- name: Setup Coursier Cache
100104
uses: coursier/[email protected]
101105
with:
102-
root: "cmt-template-scala3"
106+
root: ${{ env.THIS_REPO }}
103107

104108
- name: Studentify Repo
105109
run: |
106110
mkdir -p studentified
107111
export PATH=${PATH}:$GITHUB_WORKSPACE/CMT/bin
108112
git config --global user.email "[email protected]"
109113
git config --global user.name "Lunatech Labs"
110-
cmta studentify -f -g -m cmt-template-scala3 -d studentified
111-
(cd studentified && exec zip -r cmt-template-scala3-student.zip cmt-template-scala3)
114+
cmta studentify -f -g -m ${{ env.THIS_REPO }} -d studentified
115+
(cd studentified && exec zip -r ${{ env.THIS_REPO }}-student.zip ${{ env.THIS_REPO }})
112116
113117
- name: Linearize Repo
114118
run: |
115119
mkdir -p linearized
116-
cmta linearize -f -m cmt-template-scala3 -d linearized
117-
mv linearized/cmt-template-scala3 linearized/cmt-template-scala3-linearized
118-
(cd linearized && exec zip -r cmt-template-scala3-linearized.zip cmt-template-scala3-linearized)
120+
cmta linearize -f -m ${{ env.THIS_REPO }} -d linearized
121+
mv linearized/${{ env.THIS_REPO }} linearized/${{ env.THIS_REPO }}-linearized
122+
(cd linearized && exec zip -r ${{ env.THIS_REPO }}-linearized.zip ${{ env.THIS_REPO }}-linearized)
119123
120124
- name: Create Github Release
121125
id: create_release
@@ -134,18 +138,17 @@ jobs:
134138
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135139
with:
136140
upload_url: ${{ steps.create_release.outputs.upload_url }} # release created from previous step
137-
asset_path: ./studentified/cmt-template-scala3-student.zip
138-
asset_name: cmt-template-scala3-student.zip
141+
asset_path: ./studentified/${{ env.THIS_REPO }}-student.zip
142+
asset_name: ${{ env.THIS_REPO }}-student.zip
139143
asset_content_type: application/zip
140-
144+
141145
- name: Upload Linearized repo to Github release
142146
uses: actions/upload-release-asset@v1
143147
env:
144148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145149
with:
146150
upload_url: ${{ steps.create_release.outputs.upload_url }} # release created from previous step
147-
asset_path: ./linearized/cmt-template-scala3-linearized.zip
148-
asset_name: cmt-template-scala3-linearized.zip
151+
asset_path: ./linearized/${{ env.THIS_REPO }}-linearized.zip
152+
asset_name: ${{ env.THIS_REPO }}-linearized.zip
149153
asset_content_type: application/zip
150154

151-

0 commit comments

Comments
 (0)