Skip to content

Commit

Permalink
build(ci): publish artifacts to Terasology artifactory (#20)
Browse files Browse the repository at this point in the history
* build(ci): combine workflows into a single one
* build(ci): upgrade action dependencies
* build: update Terasology artifactory URL

---------

Co-authored-by: jdrueckert <jd.rueckert@googlemail.com>
  • Loading branch information
skaldarnar and jdrueckert authored Mar 16, 2024
1 parent 85b1a57 commit aaa94e2
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 112 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/allInOne.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build and Publish for all Platforms

on: [push]

jobs:
validate-gradle-wrapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
build-linux-windows-amd64:
runs-on: ubuntu-latest
needs: validate-gradle-wrapper
steps:
- name: Install SWIG
run: sudo apt-get install swig mingw-w64
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew buildNatives
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-windows-amd64-artifacts
path: |
build/natives/*/*.so
build/natives/*/*.dll
build/natives/*/*.dylib
build-macos-amd64:
runs-on: macos-12
needs: validate-gradle-wrapper
steps:
- name: Install SWIG and CMake
run: |
brew install swig
brew install cmake
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew native_macosx_amd64_clang
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macosx-amd64-artifacts
path: |
build/natives/*/*.so
build/natives/*/*.dll
build/natives/*/*.dylib
build-macos-aarch64:
runs-on: macos-14
needs: validate-gradle-wrapper
steps:
- name: Install SWIG and CMake
run: |
brew install swig
brew install cmake
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew native_macosx_aarch64_clang
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macosx-aarch64-artifacts
path: |
build/natives/*/*.so
build/natives/*/*.dll
build/natives/*/*.dylib
publish:
runs-on: ubuntu-latest
needs: [validate-gradle-wrapper,build-linux-windows-amd64, build-macos-amd64, build-macos-aarch64]
if: github.ref == 'refs/heads/master'
steps:
- name: Install SWIG
run: sudo apt-get install swig mingw-w64
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: build/natives
merge-multiple: true
- name: Build and Zip Natives
run: ./gradlew build zipNatives
- run: |
ls -R build/natives/
ls -R build/libs/
- name: Publish
run: ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish -PmavenUser=${artifactoryUser} -PmavenPass=${artifactoryPass}
env:
artifactoryUser: ${{ secrets.ARTIFACTORY_USER }}
artifactoryPass: ${{ secrets.ARTIFACTORY_PASS }}
36 changes: 0 additions & 36 deletions .github/workflows/linux_amd64.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/macosx_aarch64.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/macosx_amd64.yml

This file was deleted.

14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ repositories {
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name "Terasology Artifactory"
url "http://artifactory.terasology.org/artifactory/virtual-repo-live"
allowInsecureProtocol true // 😱
url "https://artifactory.terasology.io/artifactory/virtual-repo-live"
}
}
}
Expand Down Expand Up @@ -157,7 +156,9 @@ task zipNatives(type: Zip){
}

buildNatives.dependsOn generateSources
zipNatives.dependsOn buildNatives
// Building natives is a prerequisite for zipping them, but we don't want to re-compute them every time.
// Also, we build natives on different platforms and combine them to a single zip, so we can't just depend on the native tasks anyway.
//zipNatives.dependsOn buildNatives

javadoc {
failOnError = false
Expand Down Expand Up @@ -207,12 +208,11 @@ publishing {

repositories {
maven {
name = 'TerasologyOrg'
allowInsecureProtocol true // 😱 - no https on our Artifactory yet
name = 'TerasologyOrg'

if (rootProject.hasProperty("publishRepo")) {
// This first option is good for local testing, you can set a full explicit target repo in gradle.properties
url = "http://artifactory.terasology.org/artifactory/$publishRepo"
url = "https://artifactory.terasology.io/artifactory/$publishRepo"

logger.info("Changing PUBLISH repoKey set via Gradle property to {}", publishRepo)
} else {
Expand All @@ -231,7 +231,7 @@ publishing {
}

logger.info("The final deduced publish repo is {}", deducedPublishRepo)
url = "http://artifactory.terasology.org/artifactory/$deducedPublishRepo"
url = "https://artifactory.terasology.io/artifactory/$deducedPublishRepo"
}

if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) {
Expand Down

0 comments on commit aaa94e2

Please sign in to comment.