Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Shell Script with Bats | |
on: | |
push: | |
# branches: | |
# - main | |
pull_request: | |
jobs: | |
test-unix-shell: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Note: bats-core/[email protected] is not allowed to be used (needs an INFRA issue) | |
- name: Install Bats (Testing Framework) | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y bats | |
- 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: | | |
# Find the first non-src .tar.gz file in the target directory | |
TAR_FILE=$(find opennlp-distr/target -maxdepth 1 -type f -name "*.tar.gz" ! -name "*-src*.tar.gz" | head -n 1) | |
# Ensure we found a file | |
if [ -z "$TAR_FILE" ]; then | |
echo "Error: No matching tar.gz file found in opennlp-distr/target" | |
exit 1 | |
fi | |
# Extract the tar.gz file | |
tar -xzvf "$TAR_FILE" -C $HOME | |
# Get the directory name of the extracted content | |
EXTRACTED_DIR=$(tar -tf "$TAR_FILE" | head -n 1 | cut -f1 -d"/") | |
# Set OPENNLP_HOME dynamically | |
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 }} |