Skip to content

Commit

Permalink
GitHub actions (#1)
Browse files Browse the repository at this point in the history
* Trying github actions.

* Fixing projects lists.

* Attempt

* Enable native build profiles.

* Checkout submodule

* Submodules.

* Attempt to deploy.

* Publish 2

* Attemp to fix deploy.

* Attempting deploy fix.

* Noop

* Attemp to fix badrequest

* Noop

* Verbose maven.

* Disable http

* Change to username.

* Full logs.

* Adding settings.

* Update version in pom.xml

* Remove unnecessary switch.

* Print git info.

* Git fetch tags.

* Git info.

* Fetch all history.

* Git fetch all tags.

* Removed git info step.

* Attemp to fix deploy of artifact with classifier.

https://github.community/t5/GitHub-API-Development-and/GitHub-package-registry-as-Maven-repo-trouble-uploading-artifact/m-p/56826/highlight/true#M4777

* Deploy only one project.

* Attempt to fix double upload.

* Attempt to enable wagon.

* Attempt to fix double-deploy.

* Enable profile

* Switch typo.

* explicit install step.

* Attach.

* Attempt to join steps.

* Dedicated deploy step.

* Remove deploy.

* Build jniwrapper-native.

* Enable osx build

* use api token

* Disable deploy step.

* Force bash shell.

* Bash.

* Trying upload step.

* Fix upload

* Name artifacts.

* Download uploaded artifacts.

* Fixed syntax.

* Fixed sytax.

* Attempt to build java.

* Install.

* Fixed find.

* Pass file into install-file

* Upload m2.

* Workaround for non-expanded path.

* Workaround

* Attempt to build xplat.

* fixed typo

* Don't native deploy libraries, they are deployed being embedded into jnilib.jar

* Attempt to avoid usage of personal account name.

* Fetch entire history to make describe work.

* Enable GitHub Actoin only on specific branches.

* Deploy only if pushed into master

* Fixed copy-paste.
  • Loading branch information
mstyura committed Sep 22, 2020
1 parent ab26aac commit 1d5e98b
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 7 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Jitsi SCTP

on:
push:
branches: [ master, github-actions ]
pull_request:
branches: [ master ]

jobs:
build-native-libs:

strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest ]

runs-on: ${{ matrix.platform }}

name: "build usrsctp and jniwrapper-native"

steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
fetch-depth: 0 # entire history

- name: Git fetch tags
shell: bash
run: |
git fetch --all --tags
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Setup CMake
uses: jwlawson/[email protected]
with:
github-api-token: ${{ secrets.GITHUB_TOKEN }}

- name: Update version in pom.xml
shell: bash
run: |
VERSION=`git describe --match "v[0-9\.]*" --long`
echo "New version: ${VERSION:1}"
mvn versions:set -DnewVersion=${VERSION:1}
- name: Build native libraries artifacts
shell: bash
run: |
mvn -B -X -U clean package install --file pom.xml --projects org.jitsi:usrsctp,org.jitsi:jniwrapper-native --also-make --activate-profiles build-usrsctp,build-jnisctp
- name: Upload ~/.m2/repository/org/jitsi as artifacts
uses: actions/upload-artifact@v2
with:
name: m2-org-jitsi
path: ~/.m2/repository/org/jitsi/

build:
name: "Build and publish java artifacts with bundled native libraries"
needs: build-native-libs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # entire history

- name: Git fetch tags
shell: bash
run: |
git fetch --all --tags
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Update version in pom.xml
shell: bash
run: |
VERSION=`git describe --match "v[0-9\.]*" --long`
echo "New version: ${VERSION:1}"
mvn versions:set -DnewVersion=${VERSION:1}
- name: Generate Maven settings
shell: bash
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>github</id><username>${GITHUB_USERNAME}</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml
- name: Download ~/.m2/repository/org/jitsi with native artifacts
uses: actions/download-artifact@v2
with:
name: m2-org-jitsi
# full path is workaround for https://github.com/actions/download-artifact/issues/37
path: /home/runner/.m2/repository/org/jitsi/

- name: Build jitsi-sctp artifacts
shell: bash
run: |
mvn -B -X -U package install --file pom.xml --activate-profiles build-x-plat-jar
# Dedicated step to deploy artifact to avoid issue with maven uploading same package twice to GitHub packages, which causes second
# copy upload failure with "422 Unprocessable Entity" and hence build failure.
- name: Deploy artifacts
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
shell: bash
run: |
mvn -B -X deploy --file pom.xml --activate-profiles build-x-plat-jar -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }}
6 changes: 0 additions & 6 deletions jniwrapper/jnilib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jniwrapper-native</artifactId>
<version>${project.version}</version>
<classifier>freebsd-x86_64</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jniwrapper-native</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions jniwrapper/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<jnisctp_cmake_install_dir>${project.build.directory}/jnisctp_cmake/${maven_platform_classifier}/install</jnisctp_cmake_install_dir>
<!-- Allow install target to execute only if something useful is build -->
<maven.install.skip>true</maven.install.skip>
<!-- jniwrapper-native library is deployed as part of jnilib.jar by being embedded with maven assembly plugin -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<profiles>
Expand Down
4 changes: 3 additions & 1 deletion usrsctp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
<usrsctp_source_dir>${project.basedir}/usrsctp</usrsctp_source_dir>
<usrsctp_cmake_build_dir>${project.build.directory}/usrsctp_cmake/${maven_platform_classifier}/build</usrsctp_cmake_build_dir>
<usrsctp_cmake_install_dir>${project.build.directory}/usrsctp_cmake/${maven_platform_classifier}/install</usrsctp_cmake_install_dir>
<!-- Allow install target to execute only if something useful is build -->
<!-- Allow install and deploy target to execute only if something useful is build -->
<maven.install.skip>true</maven.install.skip>
<!-- usrsctp library is deployed as part of jnilib.jar by being embedded with maven assembly plugin -->
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<!-- usrsctp is only compiled if profile is enabled, e.g '-Pbuild-usrsctp' is passed to maven -->
Expand Down

0 comments on commit 1d5e98b

Please sign in to comment.