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