Skip to content

Commit fb80a4b

Browse files
Merge pull request #15 from mohammadzainabbas/zain
Zain
2 parents d2b303c + b42b3d4 commit fb80a4b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/exercise_1.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Exercise 1
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths-ignore:
7+
- '**.md'
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest]
20+
java-version: ["11"]
21+
22+
steps:
23+
24+
- name: Checkout current repo
25+
uses: actions/checkout@v3
26+
27+
- name: Setup JDK 11 (on "${{ matrix.os }}")
28+
uses: actions/setup-java@v3
29+
with:
30+
java-version: ${{ matrix.java-version }}
31+
distribution: 'temurin'
32+
cache: maven
33+
34+
- name: Run and build
35+
run: sh scripts/build_n_run.sh exercise1
36+
shell: bash

scripts/build_n_run.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /usr/bin/bash
2+
rm -r target | echo "No target directory found"
3+
mvn compile
4+
mvn exec:java -Dexec.mainClass=Main -Dexec.args="$1"

src/main/java/Main.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ else if (args[0].equals("exercise4")) {
4949
else {
5050
throw new Exception("Wrong exercise number");
5151
}
52+
ctx.close();
5253
}
5354
}

0 commit comments

Comments
 (0)