diff --git a/.github/workflows/shell-tests.yml b/.github/workflows/unix-shell-tests.yml similarity index 64% rename from .github/workflows/shell-tests.yml rename to .github/workflows/unix-shell-tests.yml index dccce5814..1758e3304 100644 --- a/.github/workflows/shell-tests.yml +++ b/.github/workflows/unix-shell-tests.yml @@ -22,7 +22,7 @@ on: pull_request: jobs: - test-unix-shell: + test-unix-shell-ubuntu: runs-on: ubuntu-latest steps: @@ -76,3 +76,49 @@ jobs: env: JAVA_HOME: ${{ env.JAVA_HOME }} OPENNLP_HOME: ${{ env.OPENNLP_HOME }} + + test-unix-shell-macos: + name: Test on macOS + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Bats (Testing Framework) + run: | + brew update + brew install bats-core + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Build with Maven + run: mvn -V clean install --no-transfer-progress -Pci -DskipTests=true + + - name: Find and Extract OpenNLP Distribution + run: | + TAR_FILE=$(find opennlp-distr/target -maxdepth 1 -type f -name "*.tar.gz" ! -name "*-src*.tar.gz" | head -n 1) + if [ -z "$TAR_FILE" ]; then + echo "Error: No matching tar.gz file found in opennlp-distr/target" + exit 1 + fi + tar -xzf "$TAR_FILE" -C $HOME + EXTRACTED_DIR=$(tar -tf "$TAR_FILE" | head -n 1 | cut -f1 -d"/") + echo "OPENNLP_HOME=$HOME/$EXTRACTED_DIR" >> $GITHUB_ENV + echo "$HOME/$EXTRACTED_DIR/bin" >> $GITHUB_PATH + + - name: Verify Extraction + run: | + echo "OPENNLP_HOME: $OPENNLP_HOME" + ls -l $OPENNLP_HOME/bin + + - name: Run Bats Tests + run: | + bats ./opennlp-distr/src/test/sh + env: + JAVA_HOME: ${{ env.JAVA_HOME }} + OPENNLP_HOME: ${{ env.OPENNLP_HOME }} \ No newline at end of file