This commit is contained in:
Nick Gerleman
2022-10-14 07:06:36 -07:00
parent c2a0ccf0d4
commit 55d614c4c2
13 changed files with 166 additions and 162 deletions

View File

@@ -0,0 +1,17 @@
name: Setup Android envirionment
runs:
using: "composite"
steps:
- name: Install JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK 21
shell: bash
run: echo "y" | /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT}
- name: Install Ninja
shell: bash
run: sudo apt-get install -y ninja-build

View File

@@ -0,0 +1,19 @@
name: Setup Website envirionment
runs:
using: "composite"
steps:
- name: Install NodeJS 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: yarn install
shell: bash
run: yarn install --frozen-lockfile
working-directory: website
- name: yarn build
shell: bash
run: yarn build
working-directory: website

View File

@@ -1,58 +0,0 @@
name: CI
on: [push, pull_request]
jobs:
website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
working-directory: website
- name: Build
run: yarn build
working-directory: website
- name: Deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: website/public
cname: yogalayout.com
keep_files: true
user_name: 'Yoga-bot'
user_email: 'yogabot@fb.com'
android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK 21
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
- name: Install dependencies
run: |
if [[ -n "${{ secrets.encrypted_d27e803291ff_iv }}" ]]; then
openssl aes-256-cbc -K ${{ secrets.encrypted_d27e803291ff_key }} -iv {{ secrets.encrypted_d27e803291ff_iv }} -in scripts/setup-keys.enc -d >> gradle.properties;
fi
sudo apt-get update
sudo apt-get install -y ninja-build
pushd $HOME
git clone --depth 1 https://github.com/facebook/buck.git
cd buck
ant
popd
echo "$HOME/buck/bin" >> $GITHUB_PATH
export PATH=$PATH:$HOME/buck/bin/
buck --version
- name: Build
# TODO: Run the tests here again. They're currently crashing the JVM in GitHub Actions for some reason.
run: ./gradlew :yoga-layout:assembleDebug

47
.github/workflows/publish-android.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Publish Android artifacts
on:
release:
types:
- created
workflow_dispatch:
inputs:
version:
description: 'Version to publish as'
required: true
jobs:
publish:
name: Upload to Maven Central
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-android
- name: Write GPG secret keyring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties
workingDirectory: ./target
run: |
if [ -z "${{ inputs.version }}" ]; then
echo "VERSION_NAME=${{ inputs.version }}" >> gradle.properties
else
version = `echo "${{ github.ref }}" | sed -E 's/v(.+)/\1/'`
echo "VERSION_NAME=$version" >> gradle.properties
fi
echo "signing.secretKeyRingFile=/tmp/secring.gpg" >> gradle.properties
echo "signing.keyId=${{ secrets.SIGNING_KEY_ID }}" >> gradle.properties
echo "signing.password=${{ secrets.SIGNING_PASSWORD }}" >> gradle.properties
echo "nmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}" >> gradle.properties
echo "mavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }}" >> gradle.properties
- name: Upload Android archives
workingDirectory: ./target
run: ./gradlew :yoga:assembleRelease publish --info
- name: Publish release
workingDirectory: ./target
run: ./gradlew closeAndReleaseRepository

26
.github/workflows/publish-website.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Publish Website artifcats
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish:
name: Push to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-website
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: website/public
cname: yogalayout.com
keep_files: true
user_name: 'Yoga-bot'
user_email: 'yogabot@fb.com'

View File

@@ -1,32 +0,0 @@
name: Publish
on:
release:
types:
- created
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install dependencies
run: source scripts/android-setup.sh && installAndroidSDK
- name: Write GPG Sec Ring
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
- name: Update gradle.properties
run: echo -e "signing.secretKeyRingFile=/tmp/secring.gpg\nsigning.keyId=${{ secrets.SIGNING_KEY_ID }}\nsigning.password=${{ secrets.SIGNING_PASSWORD }}\nmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}\nmavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }}" >> gradle.properties
- name: Upload Android Archives
run: ./gradlew :yoga:assembleRelease publish --info
- name: Release and close
run: ./gradlew closeAndReleaseRepository
- name: Clean secrets
if: always()
run: rm /tmp/secring.gpg

38
.github/workflows/valiadate-android.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Android
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Build (${{ matrix.mode }})
runs-on: ubuntu-latest
strategy:
matrix:
mode: [Debug, Release]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-android
- name: Build
run: ./gradlew assemble${{ matrix.mode }}
test:
name: Unit Tests (${{ matrix.mode }})
runs-on: ubuntu-latest
strategy:
matrix:
mode: [Debug]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-android
- name: Build
run: ./gradlew assemble${{ matrix.mode }}
- name: List
run: ls -R -l /home/runner/work/yoga/yoga/java
- name: Run Java unit tests
run: ./gradlew :yoga:test${{ matrix.mode }}UnitTest --info

12
.github/workflows/validate-website.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Website
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-website

View File

@@ -63,26 +63,8 @@ This will now only run the standalone webpack build upon install.
## Maintainer Release Guide ## Maintainer Release Guide
To publish a new release, follow these steps: Release artifacts are published automatically when a new GitHub release is
created. The publishing workflows may also be executed manually, given a Git
Tag, to re-attempt publish.
1. Ensure you have your GPG key set up and your [OSS Sonatype](https://oss.sonatype.org/) credentials handy. NPM and NuGet packages are not currently published.
2. Add the follow entries to either your local `gradle.properties` (don't forget to revert) or your global `~/.gradle/gradle.properties`:
```
# You get these from https://oss.sonatype.org/#profile;User%20Token
mavenCentralRepositoryUsername=<username>
mavenCentralRepositoryPassword=<password>
# You can get the keyId (in GPG 1.4 format) by running `gpg1 --list-keys`.
signing.secretKeyRingFile=</path/to/secring.gpg>
signing.keyId=<key_id>
signing.password=<key_password>
```
3. Change the `VERSION_NAME` in `gradle.properties` to a non-SNAPSHOT release.
4. Commit and land the version change.
5. Run `./gradlew publishToMaven`.
6. Run `./gradlew closeAndReleaseRepository`.
7. Change the `VERSION_NAME` in `gradle.properties` back to a new SNAPSHOT release.
8. Commit and land the version change.
9. Celebrate! You've made a release!

View File

@@ -37,33 +37,6 @@ ext {
targetCompatibilityVersion = JavaVersion.VERSION_1_7 targetCompatibilityVersion = JavaVersion.VERSION_1_7
} }
// If you have an idea on how to avoid this, please get in touch or
// answer https://stackoverflow.com/questions/43867014/how-to-use-the-gradle-ndk-build-to-compile-for-the-host-machine.
task copyNativeLibs(type: Copy, dependsOn: ':buckBuildNative') {
from "${rootDir}/buck-out/gen/java/tests#default,shared-library-symlink-tree/"
include '*.so'
include '*.dylib'
into "$buildDir/jniLibs"
}
task buckBuildNative(type: Exec) {
workingDir rootDir
environment BUCKVERSION: 'last'
commandLine 'buck', 'build', '//java/...'
}
allprojects {
afterEvaluate {
tasks.withType(Test) {
dependsOn copyNativeLibs
def libDir = "${rootDir}/build/jniLibs"
systemProperty 'java.library.path', libDir
environment 'LD_LIBRARY_PATH', libDir
environment 'DYLD_LIBRARY_PATH', libDir
}
}
}
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@@ -8,6 +8,8 @@
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
// TODO Proguard consumers
android { android {
compileSdkVersion rootProject.compileSdkVersion compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion buildToolsVersion rootProject.buildToolsVersion
@@ -47,7 +49,7 @@ android {
} }
test { test {
java.srcDirs 'tests' java.srcDir 'tests'
} }
} }
} }

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
#
# Deploy a SNAPSHOT JAR after every successful CI run To Sonatype.
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the LICENSE
# file in the root directory of this source tree.
#
set -e
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
if [ "$IS_SNAPSHOT" == "" ]; then
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
else
env TERMINAL=dumb "$BASEDIR/gradlew" publish
fi

View File

@@ -1 +0,0 @@
k<EFBFBD><EFBFBD><EFBFBD><04><18>=+\M<><4D>n<EFBFBD>mq6<71>P<16><>q<EFBFBD>Z<<3C>c%<25><><1D>j<EFBFBD><6A><EFBFBD>d<EFBFBD><64><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><11>9C7P`]<5D><><EFBFBD><EFBFBD>#<23>Z<EFBFBD>+<2B><><EFBFBD><EFBFBD><EFBFBD>^ 7<><37><EFBFBD><EFBFBD><EFBFBD>*<2A><><EFBFBD>r<EFBFBD>`L<>A<13>1m<31><6D><EFBFBD>0h<30>n% v<><76>