Migrate CI from TravisCI to GitHub Actions #1004
56
.github/workflows/ci.yml
vendored
Normal file
56
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
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: 8.x
|
||||||
![]() AHHHH Node 8 EOL was last year. Let's at least use 10 (or 12) AHHHH Node 8 EOL was last year. Let's at least use 10 (or 12)
![]() I just copied the Travis job ¯\_(ツ)_/¯ When I tried upgrading to a more recent version of node it broke the I just copied the Travis job ¯\\\_(ツ)\_/¯
When I tried upgrading to a more recent version of node it broke the `yarn build` step :(
|
|||||||
|
- 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/master' }}
|
||||||
|
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
|
||||||
![]() Why? Why?
![]() It was in Ref: It was in `.travis.yml`: `skip-cleanup: true`
Ref:
https://docs.travis-ci.com/user/deployment/pages/
https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-keeping-existing-files
|
|||||||
|
user_name: 'Yoga-bot'
|
||||||
|
user_email: 'yogabot@fb.com'
|
||||||
|
android:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
if [[ -n "$encrypted_d27e803291ff_iv" ]]; then
|
||||||
|
openssl aes-256-cbc -K $encrypted_d27e803291ff_key -iv $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
|
||||||
![]() Oh geez this is building Buck on every change… that's… wow. We probably actually need to do something different here since Buck master is diverging (but let's ignore that for now) Oh geez this is building Buck on every change… that's… wow. We probably actually need to do something different here since Buck master is diverging (but let's ignore that for now)
|
|||||||
|
popd
|
||||||
|
echo "::set-env name=PATH::$PATH:$HOME/buck/bin/"
|
||||||
|
export PATH=$PATH:$HOME/buck/bin/
|
||||||
|
buck --version
|
||||||
|
export TERMINAL=dumb
|
||||||
|
source scripts/android-setup.sh && installAndroidSDK
|
||||||
|
echo "::set-env name=ANDROID_SDK::$ANDROID_HOME"
|
||||||
|
echo "::set-env name=ANDROID_NDK_REPOSITORY::$HOME/android-ndk"
|
||||||
|
echo "::set-env name=ANDROID_NDK_HOME::$ANDROID_NDK_REPOSITORY/android-ndk-r15c"
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew testDebugUnit && scripts/publish-snapshot.sh
|
77
.travis.yml
77
.travis.yml
@@ -1,77 +0,0 @@
|
|||||||
language: java
|
|
||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- clang-6.0
|
|
||||||
|
|
||||||
env:
|
|
||||||
- TARGET: website
|
|
||||||
- TARGET: android
|
|
||||||
|
|
||||||
install:
|
|
||||||
- cd website
|
|
||||||
- yarn --ignore-scripts
|
|
||||||
- cd ..
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/buck
|
|
||||||
- $HOME/.gradle
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- |
|
|
||||||
if [[ -n "$encrypted_d27e803291ff_iv" ]]; then
|
|
||||||
openssl aes-256-cbc -K $encrypted_d27e803291ff_key -iv $encrypted_d27e803291ff_iv -in scripts/setup-keys.enc -d >> gradle.properties;
|
|
||||||
fi
|
|
||||||
# Android
|
|
||||||
- |
|
|
||||||
if [[ $TARGET = "android" ]]; then
|
|
||||||
pushd $HOME
|
|
||||||
git clone --depth 1 https://github.com/facebook/buck.git
|
|
||||||
cd buck
|
|
||||||
ant
|
|
||||||
popd
|
|
||||||
export PATH=$PATH:$HOME/buck/bin/
|
|
||||||
buck --version
|
|
||||||
export TERMINAL=dumb
|
|
||||||
source scripts/android-setup.sh && installAndroidSDK
|
|
||||||
export ANDROID_SDK=$ANDROID_HOME
|
|
||||||
export ANDROID_NDK_REPOSITORY=$HOME/android-ndk
|
|
||||||
export ANDROID_NDK_HOME=$ANDROID_NDK_REPOSITORY/android-ndk-r15c
|
|
||||||
fi
|
|
||||||
# Website
|
|
||||||
- |
|
|
||||||
if [[ $TARGET = "website" ]]; then
|
|
||||||
nvm install 8
|
|
||||||
nvm use 8
|
|
||||||
fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- |
|
|
||||||
if [[ $TARGET = "android" ]]; then
|
|
||||||
./gradlew testDebugUnit && scripts/publish-snapshot.sh
|
|
||||||
fi
|
|
||||||
- |
|
|
||||||
if [[ $TARGET = "website" ]]; then
|
|
||||||
pushd website
|
|
||||||
yarn build
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
provider: pages
|
|
||||||
skip-cleanup: true
|
|
||||||
github-token: $GITHUB_TOKEN
|
|
||||||
fqdn: yogalayout.com
|
|
||||||
local-dir: website/public
|
|
||||||
email: yogabot@fb.com
|
|
||||||
name: Yoga-bot
|
|
||||||
keep-history: true
|
|
||||||
on:
|
|
||||||
branch: master
|
|
||||||
condition: $TARGET = website
|
|
@@ -14,14 +14,14 @@ set -e
|
|||||||
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||||
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
|
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
|
||||||
|
|
||||||
if [ "$TRAVIS_REPO_SLUG" != "facebook/yoga" ]; then
|
if [ "$GITHUB_REPOSITORY" != "facebook/yoga" ]; then
|
||||||
echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$TRAVIS_REPO_SLUG'."
|
echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$GITHUB_REPOSITORY'."
|
||||||
exit
|
exit
|
||||||
elif [ "$TRAVIS_BRANCH" != "master" ]; then
|
elif [ "$GITHUB_REF" != "refs/heads/master" ]; then
|
||||||
echo >&2 "Skipping build. Expected branch name to be 'master', but was '$TRAVIS_BRANCH'."
|
echo >&2 "Skipping build. Expected ref name to be 'refs/heads/master', but was '$GITHUB_REF'."
|
||||||
exit
|
exit
|
||||||
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
elif [ "$GITHUB_EVENT_NAME" != "push" ]; then
|
||||||
echo >&2 "Skipping build. Only considering non-PR builds, but URL was '$TRAVIS_PULL_REQUEST'."
|
echo >&2 "Skipping build. Only considering push builds, but event was '$GITHUB_EVENT_NAME'."
|
||||||
exit
|
exit
|
||||||
elif [ "$IS_SNAPSHOT" == "" ]; then
|
elif [ "$IS_SNAPSHOT" == "" ]; then
|
||||||
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
|
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
|
||||||
|
Reference in New Issue
Block a user
We should come up with some best practice here… I almost prefer website deployment being a completely different workflow that only runs on master (so it's obvious at the workflow configuration when it runs, not needing to read this far to find out)
There's no matrix so this is a no-op I believe
I was trying to avoid writing it out twice, because for PRs it would be nice to know if the website build is broken. I'd have to copy the entire job and any changes to the build process would need to be done in two places.