Support Desktop Simulation (#2) #39
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: "Project Integration Tests" | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
export-state-example-project: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
coreBranch: [main] # Adjust branches/tags as needed | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "corretto" | |
java-version: "19" | |
- name: SetUp ois-core | |
run: | | |
git clone https://github.com/attiasas/ois-core.git --branch ${{ matrix.coreBranch }} | |
cd ois-core | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
./gradlew.bat publishToMavenLocal | |
else | |
chmod +x gradlew | |
./gradlew publishToMavenLocal | |
fi | |
cd .. # Return to the main project working directory | |
shell: bash | |
- name: Publish Plugin to MavenLocal | |
run: | | |
if [[ ${{ matrix.os }} == "windows-latest" ]]; then | |
./gradlew.bat publishToMavenLocal | |
else | |
chmod +x gradlew | |
./gradlew publishToMavenLocal | |
fi | |
shell: bash | |
- name: Run Export Task | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
./gradlew.bat -p src\\test\\resources\\projects\\state-example export --info | |
else | |
./gradlew -p src/test/resources/projects/state-example export --info | |
fi | |
shell: bash | |
- name: Check Files in Distribution Directories with Minimum Count | |
run: | | |
# Base path for directories to check | |
base_dir="src/test/resources/projects/state-example/build/ois/distribution" | |
# Define directory names with required minimum count (format: "dir_name:exact_count") | |
# Root items: 1 jar, 2 dirs (Html, Desktop) | |
dir_requirements=(":3" "Html:1" "Desktop:1") | |
# Iterate through each directory name and check conditions | |
for entry in "${dir_requirements[@]}"; do | |
# Split entry into name and exact_count using parameter expansion | |
dir_name="${entry%%:*}" | |
exact_count="${entry##*:}" | |
# Determine the directory path based on whether dir_name is empty | |
if [ -z "$dir_name" ]; then | |
dir_path="$base_dir" # Use base_dir if dir_name is empty | |
else | |
dir_path="$base_dir/$dir_name" # Use base_dir/dir_name if dir_name is specified | |
fi | |
# Check if the directory exists | |
if [ -d "$dir_path" ]; then | |
# List directory contents based on the OS | |
if [[ ${{ matrix.os }} == "windows-latest" ]]; then | |
dir "$dir_path" | |
else | |
ls -la "$dir_path" | |
fi | |
# Count files and directories within the current directory | |
actual_count=$(ls -1A "$dir_path" | wc -l) | |
# Check if the actual count meets or exceeds the minimum required count | |
if [ "$actual_count" -eq "$exact_count" ]; then | |
echo "Directory $dir_path has the exact required count" | |
else | |
echo "Directory $dir_path does not meet the exact required count. Expected $exact_count, but found $actual_count." && exit 1 | |
fi | |
else | |
echo "Directory does not exist: $dir_path" && exit 1 | |
fi | |
done | |
shell: bash |