Skip to content

Commit

Permalink
Move to Actions, sign macOS shared libraries in JAR (wpilibsuite#143)
Browse files Browse the repository at this point in the history
* Add signing with Developer ID

* Move to Actions

* Update versioning plugin
  • Loading branch information
prateekma authored Oct 27, 2020
1 parent 62bbfa8 commit 55f6784
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 236 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: CI

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
artifact-name: Win32
architecture: x86
- os: windows-latest
artifact-name: Win64
architecture: x64
- os: macos-latest
artifact-name: macOS
architecture: x64
- os: ubuntu-latest
artifact-name: Linux
architecture: x64

name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-java@v1
with:
java-version: 11
architecture: ${{ matrix.architecture }}

- uses: wpilibsuite/import-signing-certificate@v1
with:
certificate-data: ${{ secrets.APPLE_CERTIFICATE_DATA }}
certificate-passphrase: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
keychain-password: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
if: |
(matrix.artifact-name == 'macOS') && (github.repository_owner == 'wpilibsuite') &&
(startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/v'))
- name: Build with Gradle
run: ./gradlew build -PbuildServer -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }}
if: ${{ !github.repository_owner == 'wpilibsuite' || !startsWith(github.ref, 'refs/tags/v') }}

- name: Build with Gradle (Release)
run: ./gradlew build -PbuildServer -PreleaseMode -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }}
if: ${{ github.repository_owner == 'wpilibsuite' && startsWith(github.ref, 'refs/tags/v') }}

- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs

combine:
runs-on: ubuntu-latest
needs: build
name: "Combine"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-java@v1
with:
java-version: 11

- uses: actions/download-artifact@v2
with:
path: build/allOutputs

- name: Flatten Artifacts
run: |
rsync -a --delete --remove-source-files build/allOutputs/*/* build/allOutputs
find build/allOutputs -type d -empty -delete
- name: Combine (PR)
run: ./gradlew publish -PbuildServer -PprCombinePublish
if: |
(github.repository_owner != 'wpilibsuite') ||
(github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags/v'))
- name: Combine (Master)
run: ./gradlew publish -PbuildServer
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/master' }}
env:
RUN_AZURE_ARTIFACTORY_RELEASE: 'TRUE'
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Combine (Release)
run: ./gradlew publish -PbuildServer -PreleaseMode
if: ${{ github.repository_owner == 'wpilibsuite' && startsWith(github.ref, 'refs/tags/v') }}
env:
RUN_AZURE_ARTIFACTORY_RELEASE: 'TRUE'
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}

- uses: actions/upload-artifact@v2
with:
name: "Maven"
path: ~/releases
45 changes: 0 additions & 45 deletions azure-pipelines.yml

This file was deleted.

21 changes: 0 additions & 21 deletions azure-templates/job-build-mac.yml

This file was deleted.

30 changes: 0 additions & 30 deletions azure-templates/job-build-win32.yml

This file was deleted.

60 changes: 0 additions & 60 deletions azure-templates/job-build.yml

This file was deleted.

79 changes: 0 additions & 79 deletions azure-templates/stage-combine.yml

This file was deleted.

16 changes: 15 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ plugins {
id 'idea'
id 'jacoco'
id 'pmd'
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '4.0.1'
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '4.0.2'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
id 'checkstyle'
id 'edu.wpi.first.WpilibTools' version '0.6.1'
}

if (project.hasProperty('buildServer')) {
wpilibVersioning.buildServerMode = true
wpilibVersioning.useAllTags = true
}

if (project.hasProperty('releaseMode')) {
wpilibVersioning.releaseMode = true
wpilibVersioning.useAllTags = true
}

allprojects {
Expand Down Expand Up @@ -83,6 +85,18 @@ shadowJar {
archiveVersion = ""
exclude("module-info.class")
archiveClassifier.set(wpilibTools.currentPlatform.platformName)

if (project.hasProperty("developerID")) {
doLast {
exec {
workingDir rootDir
def args = ["sh", "codesign.sh", project.findProperty("developerID"),
archiveFile.get().getAsFile().getAbsolutePath()]
commandLine args
println "Location: " + archiveFile.get().getAsFile().getAbsolutePath()
}
}
}
}

publishing {
Expand Down
Loading

0 comments on commit 55f6784

Please sign in to comment.