From b69eff0703ab7f7d2c0b92e8cf2e3ac65ea9fa2b Mon Sep 17 00:00:00 2001 From: SimonIT Date: Sun, 19 Nov 2023 13:40:51 +0100 Subject: [PATCH] ci: Update and build on PR (#27) * ci: Update and build on PR * ci: Add ubuntu ports to apt mirrors * ci: Copy fix to releaseaction * docs: Add comment to snapshot deployment only done on master --- .github/workflows/pushaction.yml | 47 +++++++++++------------------ .github/workflows/releaseaction.yml | 33 +++++++------------- 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/.github/workflows/pushaction.yml b/.github/workflows/pushaction.yml index ce7887e..1837c93 100644 --- a/.github/workflows/pushaction.yml +++ b/.github/workflows/pushaction.yml @@ -1,10 +1,6 @@ name: Compile and deploy snapshot artifacts -on: - push: - branches: - - master - - sdl/** +on: [push, pull_request] # Don't worry, the actual deployment is guarded with an "if" and only done on push to master env: GRADLE_USER_HOME: .gradle @@ -12,23 +8,19 @@ jobs: macos: runs-on: macos-11 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Set up JDK 8 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 8 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2.4.2 + - run: mkdir -p SDL/build-macosarm64 # No --disable-video for macOS https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c70c727c98b24ad8b44e05285b8785be15062af0 - run: ../configure --host=aarch64-apple-darwin CFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" CPPFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" LDFLAGS="-arch arm64 -mmacosx-version-min=10.7" --disable-audio --disable-video-vulkan --disable-render --disable-filesystem --disable-threads --disable-directx --disable-mmx --disable-3dnow --disable-sse --disable-sse2 --disable-sse3 --disable-cpuinfo --disable-sensor --enable-hidapi --disable-joystick-mfi @@ -62,27 +54,20 @@ jobs: ORG_GRADLE_PROJECT_GITHUB_USERNAME: "" ORG_GRADLE_PROJECT_GITHUB_API_TOKEN: "" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Set up JDK 8 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 8 - - run: sudo sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list - - run: sudo grep "ubuntu.com/ubuntu" /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list - - run: sudo sed -i 's/amd64,i386/armhf,arm64/' /etc/apt/sources.list.d/ports.list - - run: sudo sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list + - name: Setup Gradle + uses: gradle/gradle-build-action@v2.4.2 + + - run: echo "http://ports.ubuntu.com/ubuntu-ports" | sudo tee -a /etc/apt/apt-mirrors.txt - name: Add extra platform architectures run: sudo dpkg --add-architecture i386; sudo dpkg --add-architecture armhf; sudo dpkg --add-architecture arm64 - run: sudo apt-get update || true @@ -149,9 +134,13 @@ jobs: with: name: output-libs path: build/libs/ - - name: Snapshot build deploy + - name: Snapshot build + run: + ./gradlew build + - name: Snapshot deploy + if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx' env: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: - ./gradlew build publish + ./gradlew publish diff --git a/.github/workflows/releaseaction.yml b/.github/workflows/releaseaction.yml index 0f6c890..dcaf95a 100644 --- a/.github/workflows/releaseaction.yml +++ b/.github/workflows/releaseaction.yml @@ -11,23 +11,19 @@ jobs: macos: runs-on: macos-11 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Set up JDK 8 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 8 + - name: Setup Gradle + uses: gradle/gradle-build-action@v2.4.2 + - run: mkdir -p SDL/build-macosarm64 # No --disable-video for macOS https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c70c727c98b24ad8b44e05285b8785be15062af0 - run: ../configure --host=aarch64-apple-darwin CFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" CPPFLAGS="-arch arm64 -fPIC -mmacosx-version-min=10.7" LDFLAGS="-arch arm64 -mmacosx-version-min=10.7" --disable-audio --disable-video-vulkan --disable-render --disable-filesystem --disable-threads --disable-directx --disable-mmx --disable-3dnow --disable-sse --disable-sse2 --disable-sse3 --disable-cpuinfo --disable-sensor --enable-hidapi --disable-joystick-mfi @@ -61,27 +57,20 @@ jobs: ORG_GRADLE_PROJECT_GITHUB_USERNAME: "" ORG_GRADLE_PROJECT_GITHUB_API_TOKEN: "" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Set up JDK 8 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 8 - - run: sudo sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list - - run: sudo grep "ubuntu.com/ubuntu" /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list - - run: sudo sed -i 's/amd64,i386/armhf,arm64/' /etc/apt/sources.list.d/ports.list - - run: sudo sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list + - name: Setup Gradle + uses: gradle/gradle-build-action@v2.4.2 + + - run: echo "http://ports.ubuntu.com/ubuntu-ports" | sudo tee -a /etc/apt/apt-mirrors.txt - name: Add extra platform architectures run: sudo dpkg --add-architecture i386; sudo dpkg --add-architecture armhf; sudo dpkg --add-architecture arm64 - run: sudo apt-get update || true