rename FixedString size to length #36
Workflow file for this run
This file contains hidden or 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: Build and Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-natives: | |
| name: Build natives for ${{ matrix.platform }}-${{ matrix.arch }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| arch: x64 | |
| lib: libflecs.so | |
| - os: windows-latest | |
| platform: windows | |
| arch: x64 | |
| lib: flecs.dll | |
| - os: macos-15 | |
| platform: macos | |
| arch: x64 | |
| lib: libflecs.dylib | |
| - os: macos-latest | |
| platform: macos | |
| arch: aarch64 | |
| lib: libflecs.dylib | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Install GCC (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc build-essential | |
| - name: Install GCC (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install mingw -y | |
| - name: Grant execute permission for gradlew | |
| if: runner.os != 'Windows' | |
| run: chmod +x gradlew | |
| - name: Build natives | |
| run: ./gradlew compileFlecsNative -PNATIVE_ARCH=${{ matrix.platform }}-${{ matrix.arch }} | |
| shell: bash | |
| - name: Verify native library was built | |
| run: | | |
| FILE_PATH="build/resources/main/natives/${{ matrix.platform }}-${{ matrix.arch }}/${{ matrix.lib }}" | |
| echo "Checking for native library at $FILE_PATH..." | |
| if [ ! -f "$FILE_PATH" ]; then | |
| echo "Error: Native library not found!" | |
| exit 1 | |
| fi | |
| FILE_SIZE=$(wc -c < "$FILE_PATH") | |
| MIN_SIZE=102400 | |
| echo "File size: $FILE_SIZE bytes" | |
| if [ "$FILE_SIZE" -lt "$MIN_SIZE" ]; then | |
| echo "Error: File size is too small ($FILE_SIZE bytes). Expected at least $MIN_SIZE bytes." | |
| exit 1 | |
| fi | |
| echo "✓ File exists and size is valid." | |
| ls -la "$FILE_PATH" | |
| shell: bash | |
| - name: Upload natives artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: natives-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: build/resources/main/natives/${{ matrix.platform }}-${{ matrix.arch }}/${{ matrix.lib }} | |
| retention-days: 1 | |
| publish: | |
| name: Publish to Maven Central | |
| needs: build-natives | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Download all natives | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: downloaded-natives | |
| - name: Debug downloaded artifacts | |
| run: | | |
| echo "Downloaded artifacts structure:" | |
| find downloaded-natives -type f | |
| - name: Organize natives | |
| run: | | |
| mkdir -p src/main/resources/natives | |
| for artifact_dir in downloaded-natives/natives-*/; do | |
| platform_arch=$(basename "$artifact_dir" | sed 's/^natives-//') | |
| echo "Processing $platform_arch..." | |
| mkdir -p "src/main/resources/natives/$platform_arch" | |
| cp "$artifact_dir"/* "src/main/resources/natives/$platform_arch/" | |
| done | |
| echo "Final native libraries structure:" | |
| find src/main/resources/natives -type f | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build final JAR with all natives | |
| run: ./gradlew jar -x compileFlecsNative | |
| - name: Verify JAR contents | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| echo "Verifying JAR for version $VERSION..." | |
| echo "" | |
| echo "All natives in JAR:" | |
| jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/" | sort | |
| echo "" | |
| jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/linux-x64/libflecs.so" && echo "✓ Linux x64" || echo "✗ Linux x64 MISSING" | |
| jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/windows-x64/flecs.dll" && echo "✓ Windows x64" || echo "✗ Windows x64 MISSING" | |
| jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/macos-x64/libflecs.dylib" && echo "✓ macOS x64" || echo "✗ macOS x64 MISSING" | |
| jar tf build/libs/flecs-java-$VERSION.jar | grep "natives/macos-aarch64/libflecs.dylib" && echo "✓ macOS ARM64" || echo "✗ macOS ARM64 MISSING" | |
| - name: Publish to Maven Central | |
| env: | |
| OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
| SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
| SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
| run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository |