-
Notifications
You must be signed in to change notification settings - Fork 763
151 lines (149 loc) · 4.91 KB
/
ci.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: General CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Gradle caches
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: caches-${{ runner.os }}-${{ hashFiles('**/*.gradle') }}
- name: Gradle wrapper caches
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Build everything
run: BUCK_PATH=`realpath buck/buck` ./gradlew assemble --stacktrace --no-daemon
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Gradle caches
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: caches-${{ runner.os }}-${{ hashFiles('**/*.gradle') }}
- name: Gradle wrapper caches
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Run tests
run: BUCK_PATH=`realpath buck/buck` ./gradlew test -x :litho-intellij-plugin:test -x :litho-core:test -x :litho-it:test --stacktrace --no-daemon
deploy-check:
name: Skip deploy if PR or Fork or not a SNAPSHOT version
needs: [build, tests]
if: ${{ github.event_name != 'pull_request' && github.repository == 'facebook/litho' }}
runs-on: ubuntu-latest
outputs:
is-snapshot: ${{ steps.check_snapshot.outputs.IS_SNAPSHOT != '' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check if SNAPSHOT version
id: check_snapshot
run: |
echo "IS_SNAPSHOT=`grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' gradle.properties)`" >> $GITHUB_OUTPUT
deploy:
needs: [deploy-check]
if: ${{ needs.deploy-check.outputs.is-snapshot == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x64
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9.16'
- name: Gradle caches
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: caches-${{ runner.os }}-${{ hashFiles('**/*.gradle') }}
- name: Gradle wrapper caches
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Fetch buck
run: |
(rm -rf buck && mkdir buck && \
wget https://jitpack.io/com/github/facebook/buck/v2022.05.05.01/buck-v2022.05.05.01-java11.pex && \
mv buck-v2022.05.05.01-java11.pex buck/buck && \
chmod +x buck/buck && \
ls -l buck)
- name: Publish Snapshot
run: BUCK_PATH=`realpath buck/buck` ./gradlew uploadArchives --stacktrace