OSS fix (#1017) #4950
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |