image: paulwarfie/comp1110-2023-s1-gitlab-ci:0.1.0

stages:
  - checksum
  - compliance
  - build
  - test

before_script:
  - export PATH_TO_FX=/usr/share/openjfx/lib
  - export JAVAFX_OPTIONS="--module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml,javafx.media"
  - export CP=src:/ass2/*:/shared/junit-platform-console-standalone-1.7.0.jar:$PATH_TO_FX/*
  - export JUNIT="java $JAVAFX_OPTIONS -jar /shared/junit-platform-console-standalone-1.7.0.jar --class-path src:/ass2/comp1110-ass2.jar --disable-banner"

checksum:
  tags:
    - comp1110
  stage: checksum
  script:
    - python3 /validate.py --integrity comp1110-ass2
  except:
    variables:
      - $CI_PROJECT_NAME =~ /.*-dev$/

compliance:
  tags:
    - comp1110
  stage: compliance
  script:
    - python3 /validate.py --gitlablogin ${GITLAB_USER_LOGIN} --gitlabuser "${GITLAB_USER_NAME}" --gitlabprojectname "${CI_PROJECT_NAME}" --assignment /ass2/compliance-ass2.yml
  except:
    variables:
      - $CI_PROJECT_NAME =~ /.*-dev$/
  allow_failure: true

build:
  tags:
    - comp1110
  stage: build
  script:
    - javac -encoding utf-8 $JAVAFX_OPTIONS -cp $CP src/comp1110/ass2/*.java src/comp1110/ass2/*/*.java
  artifacts:
    paths:
      - src/comp1110/ass2/*.class
      - src/comp1110/ass2/*/*.class

task3:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.IsStateStringWellFormedTest
  allow_failure: true

task4:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.IsMoveStringWellFormedTest
  allow_failure: true

task6:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.DistributeResourcesTest
  allow_failure: true

task7:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.IsMoveValidTest
  allow_failure: true

task8:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.GenerateAllValidMovesTest
  allow_failure: true

task9:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.IsPhaseOverTest
  allow_failure: true

task10:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.PlacePieceTest
  allow_failure: true

task11:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.CalculateIslandLinksScoreTest -c=comp1110.ass2.CalculateIslandMajoritiesScoreTest -c=comp1110.ass2.CalculateResourcesAndStatuettesScoreTest -c=comp1110.ass2.CalculateTotalIslandsScoreTest -c=comp1110.ass2.CalculateScoresTest
  allow_failure: true

task12:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.EndPhaseTest
  allow_failure: true

task13:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.ApplyMoveTest
  allow_failure: true

task16:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.GenerateAIMoveTest
  allow_failure: true

task17:
  tags:
    - comp1110
  stage: test
  script:
    - $JUNIT -c=comp1110.ass2.VariableBoardSizeTest -c=comp1110.ass2.ThreeFourPlayerTest -c=comp1110.ass2.VariableSizeThreeFourPlayerTest
  allow_failure: true

## Local Variables:
## mode: yaml
## End:
