Skip to content

Commit 967b6d9

Browse files
committed
GitHub Actions CI/CD configurations
1 parent 9f8a771 commit 967b6d9

File tree

4 files changed

+200
-50
lines changed

4 files changed

+200
-50
lines changed

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Maven CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "**.cpp"
9+
- "**.h"
10+
- "**.java"
11+
12+
pull_request:
13+
branches:
14+
- master
15+
16+
jobs:
17+
build:
18+
runs-on: ${{ matrix.os }}
19+
20+
strategy:
21+
matrix:
22+
os: [macos-latest, ubuntu-latest, windows-latest]
23+
java: [13]
24+
25+
env:
26+
WEBRTC_CACHE_BRANCH: 3987
27+
WEBRTC_CHECKOUT_FOLDER: ${{ github.workspace }}/.work/webrtc
28+
WEBRTC_INSTALL_FOLDER: ${{ github.workspace }}/.work/webrtc/build
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v2
33+
34+
- name: Set up Linux audio system # Required for testing
35+
if: runner.os == 'Linux'
36+
run: |
37+
sudo apt-get install -y pulseaudio
38+
pulseaudio --start
39+
40+
- name: Set up WebRTC cache
41+
uses: actions/cache@v1
42+
with:
43+
path: ${{ env.WEBRTC_INSTALL_FOLDER }}
44+
key: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}-${{ hashFiles('webrtc-jni/pom.xml') }}
45+
restore-keys: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}-
46+
47+
- name: Set up Maven cache
48+
uses: actions/cache@v1
49+
with:
50+
path: ~/.m2/repository
51+
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
52+
restore-keys: maven-${{ runner.os }}-
53+
54+
- name: Set up JDK ${{ matrix.java }}
55+
uses: actions/setup-java@v1
56+
with:
57+
java-version: ${{ matrix.java }}
58+
59+
- name: Build
60+
run: mvn package -DskipTests -s .github/workflows/settings.xml
61+
62+
- name: Test
63+
run: mvn -B jar:jar surefire:test
64+
65+
- name: Deploy
66+
env:
67+
NEXUS_USERNAME: ${{ secrets.MAVEN_USERNAME }}
68+
NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
69+
run: mvn deploy -DskipTests -s .github/workflows/settings.xml

.github/workflows/maven.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Maven CI
2+
3+
on:
4+
create:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os: [macos-latest, ubuntu-latest, windows-latest]
15+
java: [13]
16+
17+
env:
18+
WEBRTC_CACHE_BRANCH: 3987
19+
WEBRTC_CHECKOUT_FOLDER: ${{ github.workspace }}/.work/webrtc
20+
WEBRTC_INSTALL_FOLDER: ${{ github.workspace }}/.work/webrtc/build
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Set up Linux audio system # Required for testing
27+
if: runner.os == 'Linux'
28+
run: |
29+
sudo apt-get install -y pulseaudio
30+
pulseaudio --start
31+
32+
- name: Set up WebRTC cache
33+
uses: actions/cache@v1
34+
with:
35+
path: ${{ env.WEBRTC_INSTALL_FOLDER }}
36+
key: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}-${{ hashFiles('webrtc-jni/pom.xml') }}
37+
restore-keys: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ runner.os }}-
38+
39+
- name: Set up Maven cache
40+
uses: actions/cache@v1
41+
with:
42+
path: ~/.m2/repository
43+
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
44+
restore-keys: maven-${{ runner.os }}-
45+
46+
- name: Set up JDK ${{ matrix.java }}
47+
uses: actions/setup-java@v1
48+
with:
49+
java-version: ${{ matrix.java }}
50+
51+
- name: Set up GPG
52+
env:
53+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
54+
run: echo -e "$GPG_PRIVATE_KEY" | gpg --import --batch
55+
shell: bash
56+
57+
- name: Create Release
58+
if: runner.os == 'Linux' # Create release only once
59+
uses: actions/create-release@v1
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
tag_name: ${{ github.ref }}
64+
release_name: Release ${{ github.ref }}
65+
draft: false
66+
prerelease: false
67+
68+
- name: Build
69+
run: mvn package -DskipTests -s .github/workflows/settings.xml
70+
71+
- name: Test
72+
run: mvn -B jar:jar surefire:test
73+
74+
- name: Deploy
75+
env:
76+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
77+
NEXUS_USERNAME: ${{ secrets.MAVEN_USERNAME }}
78+
NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
79+
run: mvn deploy -Prelease -DskipTests -s .github/workflows/settings.xml
80+
81+
- name: Get demo bundle name
82+
id: get-bundle
83+
run: echo ::set-output name=bundle::$(basename webrtc-demo/webrtc-demo-javafx/target/webrtc-javafx-demo-*.jar)
84+
shell: bash
85+
86+
- name: Get release context
87+
id: get-release-context
88+
run: |
89+
owner=${{ github.event.repository.owner.name }}
90+
api_url=https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest
91+
upload_url=$(curl -s -u $owner:${{ secrets.GITHUB_TOKEN }} $api_url | jq -r '.upload_url')
92+
echo ::set-output name=upload_url::$upload_url
93+
shell: bash
94+
95+
- name: Upload demo release asset
96+
uses: actions/upload-release-asset@v1
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
with:
100+
upload_url: ${{ steps.get-release-context.outputs.upload_url }}
101+
asset_path: ./webrtc-demo/webrtc-demo-javafx/target/${{ steps.get-bundle.outputs.bundle }}
102+
asset_name: ${{ steps.get-bundle.outputs.bundle }}
103+
asset_content_type: application/java-archive

.github/workflows/settings.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<settings>
2+
<interactiveMode>false</interactiveMode>
3+
<servers>
4+
<server>
5+
<id>ossrh</id>
6+
<username>${env.NEXUS_USERNAME}</username>
7+
<password>${env.NEXUS_PASSWORD}</password>
8+
</server>
9+
</servers>
10+
<profiles>
11+
<profile>
12+
<id>release</id>
13+
<properties>
14+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
15+
</properties>
16+
</profile>
17+
<profile>
18+
<id>build-properties</id>
19+
<activation>
20+
<activeByDefault>true</activeByDefault>
21+
</activation>
22+
<properties>
23+
<webrtc.src.dir>${env.WEBRTC_CHECKOUT_FOLDER}</webrtc.src.dir>
24+
<webrtc.install.dir>${env.WEBRTC_INSTALL_FOLDER}</webrtc.install.dir>
25+
</properties>
26+
</profile>
27+
</profiles>
28+
</settings>

0 commit comments

Comments
 (0)