From 8c439c39a7a4130efc196ceb4a92f6ae571b837b Mon Sep 17 00:00:00 2001 From: Jonathan Earle Janzen Date: Mon, 4 May 2020 17:16:44 -0700 Subject: [PATCH 1/8] Migrate CI to GitHub Actions --- .github/workflows/ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9bc8f087 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI + +on: [push, pull_request] + +jobs: + website: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 8 + uses: actions/setup-node@v1 + with: + node-version: 8.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/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 + user_name: 'Yoga-bot' + user_email: 'yogabot@fb.com' + android: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + pushd $HOME + git clone --depth 1 https://github.com/facebook/buck.git + cd buck + ant + 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 -- 2.50.1.windows.1 From e25ab93c789597c421d1527b22bb82a0c7fea81a Mon Sep 17 00:00:00 2001 From: Jonathan Earle Janzen Date: Wed, 6 May 2020 11:23:55 -0700 Subject: [PATCH 2/8] Remove .travis.yml --- .travis.yml | 77 ----------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3ae55d1f..00000000 --- a/.travis.yml +++ /dev/null @@ -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 -- 2.50.1.windows.1 From c7095a690a813bf4ed4c6af0a0a4761d3a6a093f Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Wed, 6 May 2020 15:31:24 -0700 Subject: [PATCH 3/8] Upgrade node and remove fail-fast --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bc8f087..db34418f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,14 +5,12 @@ on: [push, pull_request] jobs: website: runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - uses: actions/checkout@v2 - - name: Use Node.js 8 + - name: Setup Node.js uses: actions/setup-node@v1 with: - node-version: 8.x + node-version: 12.x - name: Install dependencies run: yarn install --frozen-lockfile --ignore-scripts working-directory: website -- 2.50.1.windows.1 From 7cefbdd91aff53aabd2184bbb06c3af07200b188 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Wed, 6 May 2020 16:48:08 -0700 Subject: [PATCH 4/8] Revert to Node v8, newer versions can't build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db34418f..d222dcf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 with: - node-version: 12.x + node-version: 8.x - name: Install dependencies run: yarn install --frozen-lockfile --ignore-scripts working-directory: website -- 2.50.1.windows.1 From 7f9e8e6fa3aa6000692b72b8305fb3e694105098 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Thu, 7 May 2020 08:41:46 -0700 Subject: [PATCH 5/8] Remove another fail-fast --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d222dcf0..8379c217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,6 @@ jobs: user_email: 'yogabot@fb.com' android: runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - uses: actions/checkout@v2 - name: Install dependencies -- 2.50.1.windows.1 From ec1520b7097adcc2f0c2244338ff72c1e24d2a54 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Thu, 7 May 2020 08:43:57 -0700 Subject: [PATCH 6/8] Update Travis-isms in publish-snapshot script --- scripts/publish-snapshot.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/publish-snapshot.sh b/scripts/publish-snapshot.sh index 02c45457..c494f97f 100755 --- a/scripts/publish-snapshot.sh +++ b/scripts/publish-snapshot.sh @@ -14,14 +14,14 @@ set -e BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")" -if [ "$TRAVIS_REPO_SLUG" != "facebook/yoga" ]; then - echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$TRAVIS_REPO_SLUG'." +if [ "$GITHUB_REPOSITORY" != "facebook/yoga" ]; then + echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$GITHUB_REPOSITORY'." exit -elif [ "$TRAVIS_BRANCH" != "master" ]; then - echo >&2 "Skipping build. Expected branch name to be 'master', but was '$TRAVIS_BRANCH'." +elif [ "$GITHUB_REF" != "refs/heads/master" ]; then + echo >&2 "Skipping build. Expected ref name to be 'refs/heads/master', but was '$GITHUB_REF'." exit -elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo >&2 "Skipping build. Only considering non-PR builds, but URL was '$TRAVIS_PULL_REQUEST'." +elif [ "$GITHUB_EVENT_NAME" != "push" ]; then + echo >&2 "Skipping build. Only considering push builds, but event was '$GITHUB_EVENT_NAME'." exit elif [ "$IS_SNAPSHOT" == "" ]; then echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release." -- 2.50.1.windows.1 From 275defe0f200ec70d7ae6d78fa68af6ac7105a40 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Thu, 7 May 2020 09:48:26 -0700 Subject: [PATCH 7/8] Add missing build dependencies --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8379c217..4c8a72cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,11 @@ jobs: - 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 + apt-get update + apt-get install -y ninja-build pushd $HOME git clone --depth 1 https://github.com/facebook/buck.git cd buck -- 2.50.1.windows.1 From e169c6dc1e41d2191d6b0a70dc1b7740af396608 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Thu, 7 May 2020 09:53:04 -0700 Subject: [PATCH 8/8] Add sudo to apt-get commands --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c8a72cc..ccb6b297 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: 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 - apt-get update - apt-get install -y ninja-build + 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 -- 2.50.1.windows.1