-
Notifications
You must be signed in to change notification settings - Fork 201
151 lines (151 loc) · 6.08 KB
/
build.yml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI build
on:
push:
branches:
- master
- staging
- r[0-9]+.*
- bazelcism # temporary
pull_request:
branches:
- master
- r[0-9]+.*
types: [opened, reopened, synchronize, labeled, unlabeled]
env:
STAGING_PROFILE_ID: 46f80d0729c92d
jobs:
check-format:
if: github.event_name == 'pull_request'
runs-on: ubuntu-18.04
steps:
- name: Configure Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Checkout repository
uses: actions/checkout@v1
- 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
prepare:
runs-on: ubuntu-20.04
outputs:
stagingRepositoryId: ${{ steps.staging.outputs.stagingRepositoryId }}
steps:
- name: Create staging repository
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/r')
id: staging
run: |
echo "Creating staging repository with profile $STAGING_PROFILE_ID"
echo "<promoteRequest><data><description>Releasing TF Java - created by CI build</description></data></promoteRequest>" > request.xml
curl -X POST -d @request.xml -s -o response.xml -u ${{ secrets.CI_DEPLOY_USERNAME }}:${{ secrets.CI_DEPLOY_PASSWORD }} -H "Content-Type:application/xml" \
https://oss.sonatype.org/service/local/staging/profiles/$STAGING_PROFILE_ID/start
STAGING_REPOSITORY_ID=`awk -F'[<>]' '/stagedRepositoryId/{print $3}' response.xml`
echo "Staging repository created: $STAGING_REPOSITORY_ID"
echo "::set-output name=stagingRepositoryId::$STAGING_REPOSITORY_ID"
linux-x86_64:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build')
runs-on: ubuntu-20.04
needs: prepare
strategy:
matrix:
ext: ["", -gpu]
steps:
- name: Configure Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Checkout repository
uses: actions/checkout@v1
- name: Build project
run: |
gcc --version
mvn -version
echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
mvn clean install -pl '!:tensorflow-framework' -B -U -e -Djavacpp.platform=linux-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }}
macosx-x86_64:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build')
runs-on: macos-11
needs: prepare
strategy:
matrix:
ext: [""]
steps:
- name: Configure Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Checkout repository
uses: actions/checkout@v1
- name: Build project
run: |
clang --version
mvn -version
echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
mvn clean install -pl '!:tensorflow-framework' -B -U -e -Djavacpp.platform=macosx-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }}
windows-x86_64:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'CI build')
runs-on: windows-2019
needs: prepare
strategy:
matrix:
ext: [""] #, -gpu]
steps:
- name: Configure page file
uses: al-cheb/configure-pagefile-action@v1.2
with:
minimum-size: 8GB
maximum-size: 16GB
disk-root: "C:"
- name: Install environment
shell: cmd
run: |
set "PATH=C:\msys64\usr\bin;%PATH%"
python -m pip install numpy six
set "EXT=${{ matrix.ext }}"
echo %JAVA_HOME%
- name: Configure Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Checkout repository
uses: actions/checkout@v1
- name: Build project
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
set "PATH=C:\msys64\usr\bin;%PATH%"
mkdir C:\tmp
bash --version
git --version
cl
call mvn -version
echo ^<settings^>^<servers^>^<server^>^<id^>ossrh^</id^>^<username^>${{ secrets.CI_DEPLOY_USERNAME }}^</username^>^<password^>${{ secrets.CI_DEPLOY_PASSWORD }}^</password^>^</server^>^</servers^>^</settings^> > %USERPROFILE%\.m2\settings.xml
set "SKIP_EXPORT=true"
call mvn clean install -pl \!org.tensorflow:tensorflow-framework -B -U -e -Djavacpp.platform=windows-x86_64 -Djavacpp.platform.extension=${{ matrix.ext }} -am -DstagingRepositoryId=${{ needs.prepare.outputs.stagingRepositoryId }}
if ERRORLEVEL 1 exit /b
deploy:
if: github.event_name == 'push' && contains(github.ref, 'master')
needs: [linux-x86_64, macosx-x86_64, windows-x86_64]
runs-on: ubuntu-20.04
steps:
- name: Configure Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Checkout repository
uses: actions/checkout@v1
- name: Deploy snapshot artifacts
run: |
echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > settings.xml
bash deploy.sh