diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..7b2774a8cc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: Java CI with Maven + +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Move into project directory + working-directory: ./TourGuide + run: pwd + + - name: Install local JAR dependencies + working-directory: ./TourGuide + run: | + mvn install:install-file -Dfile=libs/gpsUtil.jar -DgroupId=gpsUtil -DartifactId=gpsUtil -Dversion=1.0.0 -Dpackaging=jar + mvn install:install-file -Dfile=libs/RewardCentral.jar -DgroupId=rewardCentral -DartifactId=rewardCentral -Dversion=1.0.0 -Dpackaging=jar + mvn install:install-file -Dfile=libs/TripPricer.jar -DgroupId=tripPricer -DartifactId=tripPricer -Dversion=1.0.0 -Dpackaging=jar + + - name: Build and test with Maven + working-directory: ./TourGuide + run: mvn clean verify --no-transfer-progress + + - name: Package application + working-directory: ./TourGuide + run: mvn package -DskipTests --no-transfer-progress + + - name: Upload built artifact + uses: actions/upload-artifact@v4 + with: + name: tourguide-jar + path: TourGuide/target/*.jar