Repository navigation
100 lines (95 loc) · 3 KB
/
Copy pathbuild_github.yaml
File metadata and controls
100 lines (95 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI build
on:
workflow_dispatch:
push:
branches:
- master
- staging
- r[0-9]+.*
pull_request:
branches:
- master
- r[0-9]+.*
types: [opened, reopened, synchronize, labeled, unlabeled]
env:
DEPLOY_SNAPSHOT: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging') }}
DEPLOY_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r') }}
jobs:
check-format:
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
steps:
- name: Configure Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Checkout repository
uses: actions/checkout@v3
- name: Build project
run: |
gcc --version
mvn -version
mvn clean install -Pjdk17 -B -U -e -Dlint.skip=true -Dmaven.test.skip=true
- name: Run format checks
run: |
mvn spotless:check -Pjdk17 -B -U -e
build:
runs-on: ubuntu-22.04
needs: check-format
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
java-version: [11, 17]
steps:
- name: Configure Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java-version }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Build project
run: |
gcc --version || true
clang --version || true
mvn -version
mvn clean install -B -U -e -Djavacpp.platform=${{ matrix.os }} -Djavacpp.platform.extension=""
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ matrix.os }}-java${{ matrix.java-version }}
path: |
target/*.jar
target/*.zip
release:
if: env.DEPLOY_RELEASE == 'true' || env.DEPLOY_SNAPSHOT == 'true'
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts-ubuntu-22.04-java11
path: build_artifacts
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
body: |
Automated release from CI workflow running on ${{ github.ref_name }}.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build_artifacts/*.jar
asset_name: tensorflow-java-${{ github.ref_name }}.jar
asset_content_type: application/java-archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}