From 645c87ca4dfd4496fecc1e6c977330de73b11ba5 Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Thu, 24 Sep 2020 21:09:54 +0300 Subject: [PATCH] CI configuration --- .github/workflows/CI.yml | 310 +++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 30 ++-- .github/workflows/javadoc.yml | 39 +++++ .github/workflows/snapshot.yml | 59 +++++++ build.xml | 5 +- 5 files changed, 424 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/CI.yml create mode 100644 .github/workflows/javadoc.yml create mode 100644 .github/workflows/snapshot.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000000..ec3cffcb1a --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,310 @@ +name: LWJGL CI Build + +on: + workflow_dispatch: + push: + branches: + - master + +env: + AWS_DEFAULT_REGION: us-east-1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + JAVA_HOME: jdk8 + ANT_OPTS: -Xmx2G + LWJGL_BUILD_TYPE: nightly + ZULU_BUILD: 80.0.17-ca-jdk8.0.422 + +jobs: + check-kotlinc-cache: + name: Check kotlinc cache + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + - name: Download JDK + run: | + mkdir jdk8 + curl https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + - name: Check generator hydration + run: ant -emacs hydrate-kotlinc + id: hydration + continue-on-error: true + - name: Cache kotlinc output + run: | + git clone https://github.com/LWJGL-CI/OculusSDK.git ../OculusSDK + ANT_OPTS=-Xmx4G ant -emacs cache-kotlinc -Drevision="HEAD~2..HEAD~1" + if: steps.hydration.outcome == 'failure' + + linux: + name: Linux + needs: check-kotlinc-cache + runs-on: ubuntu-latest + container: + image: centos:7 + strategy: + fail-fast: false + matrix: + ARCH: [x64] + include: + - ARCH: x64 + defaults: + run: + shell: bash + env: + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + steps: + - name: Upgrade git + run: | + sed -i \ + -e 's/^mirrorlist/#mirrorlist/' \ + -e 's/^#baseurl/baseurl/' \ + -e 's/mirror\.centos\.org/vault.centos.org/' \ + /etc/yum.repos.d/*.repo + yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm + yum -y install git + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 3 + - name: Configure yum + run: | + yum -y install epel-release + yum -y update + - name: Install build dependencies + run: | + yum -y install centos-release-scl + sed -i \ + -e 's/^mirrorlist/#mirrorlist/' \ + -e 's/^#baseurl/baseurl/' \ + -e 's/^# baseurl/baseurl/' \ + -e 's/mirror\.centos\.org/vault.centos.org/' \ + /etc/yum.repos.d/CentOS-SCLo-scl*.repo + yum -y install devtoolset-11-gcc-c++ + yum -y install ant awscli + - name: Install LWJGL dependencies + run: | + yum -y install libX11-devel libXt-devel gtk3-devel libdbus-1-dev + mkdir jdk8 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + - name: Hydrate generator + run: | + git config --global --add safe.directory $PWD + ant -emacs hydrate-kotlinc clean-generated generate + - name: Build Java + run: ant -emacs compile + - name: Build native + run: | + source scl_source enable devtoolset-11 || true + ant -emacs compile-native + - name: Run tests + run: | + source scl_source enable devtoolset-11 || true + ant -emacs tests + - name: Upload artifacts + run: | + source scl_source enable devtoolset-11 || true + ant -emacs upload-native + + linux-cross: + name: Linux Cross + needs: check-kotlinc-cache + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + ARCH: [arm32, arm64, ppc64le, riscv64] + include: + # ---- + - ARCH: arm32 + CROSS_ARCH: armhf + TRIPLET: arm-linux-gnueabihf + # ---- + - ARCH: arm64 + CROSS_ARCH: arm64 + TRIPLET: aarch64-linux-gnu + # ---- + - ARCH: ppc64le + CROSS_ARCH: ppc64el + TRIPLET: powerpc64le-linux-gnu + # ---- + - ARCH: riscv64 + CROSS_ARCH: riscv64 + TRIPLET: riscv64-linux-gnu + env: + LWJGL_BUILD_ARCH: ${{matrix.ARCH}} + defaults: + run: + shell: bash + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + - name: Install dependencies + run: | + git config --global --add safe.directory $(pwd) + DEBIAN_FRONTEND=noninteractive sudo apt-get -yq update + DEBIAN_FRONTEND=noninteractive sudo apt-get -yq install ant awscli curl gcc-${{matrix.TRIPLET}} g++-${{matrix.TRIPLET}} libc6-dev-${{matrix.CROSS_ARCH}}-cross + mkdir jdk8 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + - name: Prepare cross-compilation for ${{matrix.CROSS_ARCH}} + run: | + sudo sed -i 's/deb mirror/deb [arch=amd64,i386] mirror/' /etc/apt/sources.list + sudo grep "mirror+file" /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list + sudo sed -i 's/amd64,i386/${{matrix.CROSS_ARCH}}/' /etc/apt/sources.list.d/ports.list + sudo sed -i 's#mirror+file:/etc/apt/apt-mirrors.txt#http://ports.ubuntu.com/ubuntu-ports/#' /etc/apt/sources.list.d/ports.list + sudo dpkg --add-architecture ${{matrix.CROSS_ARCH}} + sudo apt-get update || true + - name: Install cross-compilation dependencies + run: DEBIAN_FRONTEND=noninteractive sudo apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install libgtk-3-dev:${{matrix.CROSS_ARCH}} libatk-bridge2.0-dev:${{matrix.CROSS_ARCH}} libgdk-pixbuf2.0-dev:${{matrix.CROSS_ARCH}} libglu-dev:${{matrix.CROSS_ARCH}} libgl1-mesa-glx:${{matrix.CROSS_ARCH}} libx11-dev:${{matrix.CROSS_ARCH}} libxt-dev:${{matrix.CROSS_ARCH}} libdbus-1-dev:${{matrix.CROSS_ARCH}} -o Dpkg::Options::="--force-overwrite" + - name: Hydrate generator + run: ant -emacs hydrate-kotlinc clean-generated generate + - name: Build Java + run: ant -emacs compile + - name: Build native + run: ant -emacs compile-native -Dgcc.libpath.opengl=/usr/lib/${{matrix.TRIPLET}}/mesa + - name: Upload artifacts + run: ant -emacs upload-native + + freebsd-cross: + name: FreeBSD Cross + needs: check-kotlinc-cache + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + fetch-tags: true + - name: Install dependencies + run: | + mkdir jdk8 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + - name: Restore kotlinc output + uses: actions/cache/restore@v3 + with: + path: | + bin/classes/generator + bin/classes/templates + key: cache-kotlinc-${{ github.sha }} + enableCrossOsArchive: true + fail-on-cache-miss: true + - name: Hydrate generator + run: ant -emacs hydrate-kotlinc clean-generated generate + - name: Build Java + run: ant -emacs compile + - name: Build, test and upload artifacts + uses: cross-platform-actions/action@v0.24.0 + with: + operating_system: freebsd + architecture: x86-64 + version: '13.2' + memory: 8G + shell: bash + environment_variables: AWS_DEFAULT_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY ANT_OPTS LWJGL_BUILD_TYPE + run: | + sudo pkg install -y git openjdk8 apache-ant devel/py-awscli gtk3 dbus + git config --global --add safe.directory $PWD + ant -emacs compile-native + ant -emacs tests + ant -emacs upload-native + + macos: + name: macOS + needs: check-kotlinc-cache + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + ARCH: [x64, arm64] + include: + - ARCH: x64 + JDK: macosx_x64 + - ARCH: arm64 + JDK: macosx_aarch64 + env: + LWJGL_BUILD_ARCH: ${{matrix.ARCH}} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + - name: Install dependencies + run: | + mkdir jdk8 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-${{matrix.JDK}}.tar.gz | tar xz -C jdk8 --strip-components 1 + - name: Hydrate generator + run: ant -emacs hydrate-kotlinc clean-generated generate + - name: Build Java + run: ant -emacs compile + - name: Build native + run: ant -emacs compile-native + - name: Run tests + run: ant -emacs tests + - name: Upload artifacts + run: ant -emacs upload-native + + windows: + name: Windows + needs: check-kotlinc-cache + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + ARCH: [x86, x64, arm64] + include: + - ARCH: x86 + JDK: win_i686 + MSVC_ARCH: amd64_x86 + - ARCH: x64 + JDK: win_x64 + MSVC_ARCH: amd64 + - ARCH: arm64 + JDK: win_x64 + MSVC_ARCH: amd64_arm64 + env: + ANT_OPTS: -Xmx1G + LWJGL_BUILD_ARCH: ${{matrix.ARCH}} + defaults: + run: + shell: cmd + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 3 + - name: Configure MSVC + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.MSVC_ARCH }} + - name: Clone Oculus SDK + run: git clone https://github.com/LWJGL-CI/OculusSDK.git ../OculusSDK + if: contains(matrix.ARCH, 'arm') != true + - name: Install dependencies + run: | + Invoke-WebRequest https://cdn.azul.com/zulu/bin/zulu8.${Env:ZULU_BUILD}-${{matrix.JDK}}.zip -OutFile jdk.zip + Expand-Archive -Path jdk.zip -DestinationPath .\ + Move-Item .\zulu8* .\jdk8 + shell: pwsh + - name: Generate bindings + run: ant -emacs hydrate-kotlinc clean-generated generate + - name: Build Java + run: ant -emacs compile + - name: Build native + run: | + set PATH=%PATH:C:\Program Files\LLVM\bin;=% + ant -emacs compile-native + - name: Run tests + run: ant -emacs tests + if: contains(matrix.ARCH, 'arm') != true + - name: Print test results + run: type bin\test\testng-results.xml + if: failure() + - name: Upload artifacts + run: ant -emacs upload-native diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d497a8f5f3..a8bf9b5438 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,9 +4,9 @@ name: LWJGL Build on: workflow_dispatch: - push: - branches: - - master + #push: + #branches: + #- master env: JAVA_HOME: jdk8 @@ -122,9 +122,9 @@ jobs: - name: Build GraalVM Native Image run: | source scl_source enable devtoolset-11 || true - mkdir jdk-graalvm-22 - curl -L https://download.oracle.com/graalvm/22/latest/graalvm-jdk-22_linux-x64_bin.tar.gz | tar xz -C jdk-graalvm-22 --strip-components 1 - jdk-graalvm-22/bin/native-image -cp \ + mkdir jdk-graalvm + curl -L https://download.oracle.com/graalvm/23/latest/graalvm-jdk-23_linux-x64_bin.tar.gz | tar xz -C jdk-graalvm --strip-components 1 + jdk-graalvm/bin/native-image -cp \ bin/classes/lwjgl/core:\ bin/classes/lwjgl/lz4:\ bin/classes/samples:\ @@ -136,7 +136,7 @@ jobs: - name: Run demo with GraalVM JIT run: | source scl_source enable devtoolset-11 || true - JAVA_HOME=jdk-graalvm-22 ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 + JAVA_HOME=jdk-graalvm ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 - name: Run demo with GraalVM Native Image run: ./org.lwjgl.demo.util.lz4.hellolz4 @@ -301,9 +301,9 @@ jobs: run: ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 - name: Build GraalVM Native Image run: | - mkdir jdk-graalvm-22 - curl -L https://download.oracle.com/graalvm/22/latest/graalvm-jdk-22_macos-${{matrix.JDK}}_bin.tar.gz | tar xz -C jdk-graalvm-22 --strip-components 1 - jdk-graalvm-22/Contents/Home/bin/native-image -cp \ + mkdir jdk-graalvm + curl -L https://download.oracle.com/graalvm/23/latest/graalvm-jdk-23_macos-${{matrix.JDK}}_bin.tar.gz | tar xz -C jdk-graalvm --strip-components 1 + jdk-graalvm/Contents/Home/bin/native-image -cp \ bin/classes/lwjgl/core:\ bin/classes/lwjgl/lz4:\ bin/classes/samples:\ @@ -313,7 +313,7 @@ jobs: config/native-image \ org.lwjgl.demo.util.lz4.HelloLZ4 --verbose --no-fallback - name: Run demo with GraalVM JIT - run: JAVA_HOME=jdk-graalvm-22/Contents/Home ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 + run: JAVA_HOME=jdk-graalvm/Contents/Home ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 - name: Run demo with GraalVM Native Image run: ./org.lwjgl.demo.util.lz4.hellolz4 @@ -390,14 +390,14 @@ jobs: if: matrix.ARCH == 'x64' - name: Download GraalVM run: | - Invoke-WebRequest https://download.oracle.com/graalvm/22/latest/graalvm-jdk-22_windows-x64_bin.zip -OutFile jdk-graalvm.zip + Invoke-WebRequest https://download.oracle.com/graalvm/23/latest/graalvm-jdk-23_windows-x64_bin.zip -OutFile jdk-graalvm.zip Expand-Archive -Path jdk-graalvm.zip -DestinationPath .\ - Get-ChildItem graalvm-jdk-22* | Rename-Item -newname jdk-graalvm-22 + Get-ChildItem graalvm-jdk-23* | Rename-Item -newname jdk-graalvm shell: pwsh if: matrix.ARCH == 'x64' - name: Build GraalVM Native Image run: | - jdk-graalvm-22\bin\native-image -cp ^ + jdk-graalvm\bin\native-image -cp ^ bin/classes/lwjgl/core;^ bin/classes/lwjgl/lz4;^ bin/classes/samples;^ @@ -409,7 +409,7 @@ jobs: if: matrix.ARCH == 'x64' - name: Run demo with GraalVM JIT run: | - set JAVA_HOME=jdk-graalvm-22 + set JAVA_HOME=jdk-graalvm ant demo -Dclass=org.lwjgl.demo.util.lz4.HelloLZ4 if: matrix.ARCH == 'x64' - name: Run demo with GraalVM Native Image diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml new file mode 100644 index 0000000000..e268f16690 --- /dev/null +++ b/.github/workflows/javadoc.yml @@ -0,0 +1,39 @@ +# Generates javadoc for core + all bindings and uploads it to S3. +# The resulting javadoc is available at https://javadoc.lwjgl.org/ +name: LWJGL Javadoc generation + +on: + workflow_dispatch: + +env: + AWS_DEFAULT_REGION: us-east-1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + S3_PARAMS: --cache-control "public,must-revalidate,proxy-revalidate,max-age=0" + LWJGL_BUILD_TYPE: nightly + ZULU_BUILD: 80.0.17-ca-jdk8.0.422 + ZULU_BUILD21: 36.17-ca-jdk21.0.4 + +jobs: + macos: + name: Javadoc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 3 + - run: | + git clone https://github.com/LWJGL-CI/OculusSDK.git ../OculusSDK + mkdir jdk8 + mkdir jdk21 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + curl -L https://cdn.azul.com/zulu/bin/zulu21.${ZULU_BUILD21}-linux_x64.tar.gz | tar xz -C jdk21 --strip-components 1 + name: Install dependencies + - run: JAVA_HOME=$(pwd)/jdk8 ant -emacs hydrate-kotlinc clean-generated generate + name: Generate bindings + - run: JAVA_HOME=$(pwd)/jdk8 ant -emacs compile + name: Build Java + - run: JAVA8_HOME=$(pwd)/jdk8 JAVA_HOME=$(pwd)/jdk21 ANT_OPTS="-Djava.security.manager=allow" ant -emacs javadoc + name: Generate javadoc + - run: aws s3 sync bin/javadoc s3://lwjgl-javadoc/ --delete + name: Upload javadoc to S3 \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000000..cb3fbc15f4 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,59 @@ +# Produces a new build, uploads it to S3 and publishes a Maven snapshot +name: LWJGL Snapshot + +on: + workflow_dispatch: + +env: + AWS_DEFAULT_REGION: us-east-1 + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + S3_PARAMS: --cache-control "public,must-revalidate,proxy-revalidate,max-age=0" + ANT_OPTS: -Xmx8G + LWJGL_BUILD_TYPE: nightly + ZULU_BUILD: 80.0.17-ca-jdk8.0.422 + ZULU_BUILD21: 36.17-ca-jdk21.0.4 + +jobs: + macos: + name: Snapshot + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 3 + - uses: gradle/wrapper-validation-action@v1 + - run: | + aws s3 cp s3://lwjgl-build/ci/next-build.txt . + LWJGL_BUILD=$(cat next-build.txt) + echo "LWJGL_BUILD=$LWJGL_BUILD" >> $GITHUB_ENV + name: Retrieve build number + - run: | + git clone https://github.com/LWJGL-CI/OculusSDK.git ../OculusSDK + mkdir jdk8 + mkdir jdk21 + curl -L https://cdn.azul.com/zulu/bin/zulu8.${ZULU_BUILD}-linux_x64.tar.gz | tar xz -C jdk8 --strip-components 1 + curl -L https://cdn.azul.com/zulu/bin/zulu21.${ZULU_BUILD21}-linux_x64.tar.gz | tar xz -C jdk21 --strip-components 1 + name: Install dependencies + - run: JAVA_HOME=$(pwd)/jdk8 ant -emacs hydrate-kotlinc clean-generated generate + name: Generate bindings + - run: JAVA_HOME=$(pwd)/jdk8 ant -emacs compile + name: Build Java + - run: | + export JAVA_HOME=$(pwd)/jdk21 + JAVA8_HOME=$(pwd)/jdk8 ANT_OPTS="$ANT_OPTS -Djava.security.manager=allow" ant -emacs release -Dbuild.revision=${{env.LWJGL_BUILD}} + $JAVA_HOME/bin/jar cfM lwjgl.zip -C bin/RELEASE . + name: "Package snapshot #${{env.LWJGL_BUILD}}" + - run: | + aws s3 cp lwjgl.zip s3://lwjgl-build/nightly/lwjgl.zip $S3_PARAMS + aws s3 sync bin/RELEASE s3://lwjgl-build/nightly/bin --delete $S3_PARAMS + name: Upload snapshot to S3 + - run: | + export JAVA_HOME=$(pwd)/jdk8 + ./gradlew -Psnapshot -PsonatypeUsername=${{ secrets.SONATYPE_USER }} -PsonatypePassword=${{ secrets.SONATYPE_PWD }} publish + name: Publish snapshot to Maven + - run: | + echo -n $((LWJGL_BUILD+1)) > next-build.txt + echo "Next build will be #$(cat next-build.txt)" + aws s3 cp next-build.txt s3://lwjgl-build/ci/ + name: Bump build number diff --git a/build.xml b/build.xml index c7d27bb61d..d3bd529c8c 100644 --- a/build.xml +++ b/build.xml @@ -1403,6 +1403,7 @@ notree="true" public="true" failonerror="true" + verbose="true" unless:set="javadoc.skip" > LWJGL - @{title}]]> @@ -1537,8 +1538,6 @@ - - @@ -1991,7 +1990,5 @@ - -