From 0df864ab72e157e2d345ff9c7ea5df59cb15aa28 Mon Sep 17 00:00:00 2001 From: wooferzfg Date: Sun, 19 Jan 2020 15:31:28 -0600 Subject: [PATCH] Set up GitHub Actions --- .github/workflows/build.sh | 13 ++++++ .github/workflows/ci.yml | 76 +++++++++++++++++++++++++++++++++++ .github/workflows/install.sh | 14 +++++++ .travis.yml | 32 --------------- README.md | 2 +- ci/deploy_key.enc | Bin 3248 -> 0 bytes ci/deploy_key.pub | 1 - ci/install.sh | 39 ------------------ ci/script.sh | 44 -------------------- 9 files changed, 104 insertions(+), 117 deletions(-) create mode 100644 .github/workflows/build.sh create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/install.sh delete mode 100644 .travis.yml delete mode 100644 ci/deploy_key.enc delete mode 100644 ci/deploy_key.pub delete mode 100644 ci/install.sh delete mode 100644 ci/script.sh diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100644 index 0000000..1a1a358 --- /dev/null +++ b/.github/workflows/build.sh @@ -0,0 +1,13 @@ +set -ex + +doCompile() { + npm install + npm run build:core + npm run publish + + WASM_FILE=$(ls dist/*.wasm) + ~/binaryen/bin/wasm-opt -O4 "$WASM_FILE" -o "$WASM_FILE" + wasm-gc "$WASM_FILE" +} + +doCompile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..388a588 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: CI + +on: + pull_request: + push: + branches: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout commit + uses: actions/checkout@v1 + + - name: Checkout submodules + run: git submodule update --init --recursive + + - name: Cache Cargo + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ runner.os }}-cargo + + - name: Cache binaryen + uses: actions/cache@v1 + with: + path: ~/binaryen + key: ${{ runner.os }}-binaryen + + - name: Cache target + uses: actions/cache@v1 + with: + path: livesplit-core/target + key: ${{ runner.os }}-target + + - name: Install Node + uses: actions/setup-node@v1 + with: + node-version: '12.x' # FIXME: https://github.com/actions/setup-node/issues/26 + + - name: Install Rust + uses: hecrj/setup-rust-action@v1 + with: + rust-version: 'nightly' + + - name: Install target + run: rustup target add wasm32-unknown-unknown + + - name: Install dependencies + run: | + set -e + sh .github/workflows/install.sh + source ~/.cargo/env || true + + - name: Build application + run: bash .github/workflows/build.sh + + - name: Commit deployment files + if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master' + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + git checkout -b gh-pages + mv dist/* . + git add :/ + git commit -m "GitHub Pages build" + + - name: Deploy application + if: github.repository == 'LiveSplit/LiveSplitOne' && github.ref == 'refs/heads/master' + uses: ad-m/github-push-action@master + with: + branch: 'gh-pages' + force: true + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/install.sh b/.github/workflows/install.sh new file mode 100644 index 0000000..02dcefe --- /dev/null +++ b/.github/workflows/install.sh @@ -0,0 +1,14 @@ +set -ex + +main() { + cd $HOME + git -C binaryen pull || git clone https://github.com/WebAssembly/binaryen binaryen + cd binaryen + cmake . + make wasm-opt + + cargo install wasm-gc + cargo install wasm-bindgen-cli +} + +main diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5549dd9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: node_js -services: docker -dist: bionic - -env: - global: - - CRATE_NAME=LiveSplitOne - - ENCRYPTION_LABEL: 341f345e5c8f -matrix: - include: - - env: TARGET=wasm32-unknown-unknown - rust: nightly -before_install: set -e -install: -- sh ci/install.sh -- source ~/.cargo/env || true -script: -- bash ci/script.sh -after_script: set +e -cache: - directories: - - $HOME/.cargo - - $HOME/binaryen - - $TRAVIS_BUILD_DIR/livesplit-core/target -before_cache: -- chmod -R a+r $HOME/.cargo -notifications: - email: - on_success: never - -node_js: - - "12" diff --git a/README.md b/README.md index 97cdf6e..ba9504e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LiveSplit LiveSplit One -[![Build Status](https://travis-ci.org/LiveSplit/LiveSplitOne.svg?branch=master)](https://travis-ci.org/LiveSplit/LiveSplitOne) [![Greenkeeper badge](https://badges.greenkeeper.io/LiveSplit/LiveSplitOne.svg)](https://greenkeeper.io/) +[![Build Status](https://github.com/LiveSplit/LiveSplitOne/workflows/CI/badge.svg)](https://github.com/LiveSplit/LiveSplitOne/actions) [![Greenkeeper badge](https://badges.greenkeeper.io/LiveSplit/LiveSplitOne.svg)](https://greenkeeper.io/) LiveSplit One is a version of LiveSplit that uses the multiplatform [livesplit-core](https://github.com/LiveSplit/livesplit-core) Library and Web diff --git a/ci/deploy_key.enc b/ci/deploy_key.enc deleted file mode 100644 index 65ef963a97a6e2785cad6a463ce6bfde147edd28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3248 zcmV;h3{UfCXiY{Qrir z7<8+0o3)Uyjntd?H@u@Xw|kFlw-;#XS_cM~3jBpQxThTdHgfdo5&@9fOq4lomBcYT zwevJ5w;YQuJc&R)&&bhMXeNdd(TXSH2S@kZS&m(}?VGmMfze30bC{c`^PeCL~ zOw-58#hF}xKG#YN8hb1j+cCrGILQhd-wAUZXWSEbxUD($H@%;}rF<$DAF(QixJ(wO zUaWnKd|VM!$gye>FwS*Q_z$L?1q_2S18*dq%X80!zU0@2iDlV9Rju_RrYDSnV^}&U3E#zd2A9m@ zA|G^42~n#`j|rZfoJS}e$7`Xm8>#9{qBi|?t~Jd`Vy7GgL0$wW)kx_XFLaI9^4#v~ zOn8BHyZwlZx{!oba9(%6y=1otnsU10b6CQ)r7@mYmy_|3? zQXu>X)W7(|T^q}Mn{&4Is8Y}Pgr@m2a3Oz&ZU3OJO#4AReB!RaczOB>;>(Fa4fP+z z!Tmw9_D65>MusOUWaQyu?(R)=d(`0Jr3-2(!6IyRBZvG5P?BU&G$Ssq*Np+-hIWY# z>WG{TpQa&(o&fR)BYw&n0KKou5b#MWopD+kPCh3+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VFnlh9t2VCGO4wS9RWjJC6PcEw9VRoAsLhUB8BjGaVKbiMZzOyEQ4XXutD6wM1SorNkaPeQQ4m/n/2UcHGsyF9SEZk77O9KLOtrvw567r51s1C0L1F92qGPsGhewQ+hmEHQPFXMaLX4/ArSFdhMV1T3zcbdb6/svtEu9mCyWvt3zCWehvCCMc/SlKrtXUgcWWlcpqzIoclHEa3eDnmLXuK6WusESUQJS1shjAEgR4Onr6a4d4wVDRNwiHxfcEas3gQx2BVgNh0YJBD0vnW+1/ckdqJ/uWrT0R+uOCLVuiwmnNwnbdjlt6GefwMPvSMWFBZO4mS/8FeEbig1tvP3ndKCk8yY5suLpUIY7VOdIsP1ZxS+ZjqMXujedOQ== christopher.serr@gmail.com diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 1a06378..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,39 +0,0 @@ -set -ex - -main() { - curl -sSf https://build.travis-ci.org/files/rustup-init.sh | sh -s -- --default-toolchain=nightly -y - export PATH=$HOME/.cargo/bin:$PATH - - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - fi - - cd $HOME - git -C binaryen pull || git clone https://github.com/WebAssembly/binaryen binaryen - cd binaryen - cmake . - make wasm-opt - - rustup target install $TARGET - - cargo install -f wasm-gc - cargo install -f wasm-bindgen-cli - - # This fetches latest stable release - local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - | cut -d/ -f3 \ - | grep -E '^v[0.1.0-9.]+$' \ - | $sort --version-sort \ - | tail -n1) - - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index 4d54cb3..0000000 --- a/ci/script.sh +++ /dev/null @@ -1,44 +0,0 @@ -# This script takes care of testing your crate - -set -ex - -SOURCE_BRANCH="master" -TARGET_BRANCH="gh-pages" - -doCompile() { - npm install - npm run build:core - npm run publish - - WASM_FILE=$(ls dist/*.wasm) - $HOME/binaryen/bin/wasm-opt -O4 "$WASM_FILE" -o "$WASM_FILE" - wasm-gc "$WASM_FILE" -} - -if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then - echo "Skipping deploy; just doing a build." - doCompile - exit 0 -fi - -doCompile - -git config --global user.email "christopher.serr@gmail.com" -git config --global user.name "Travis CI" -git checkout -b gh-pages -mv dist/* . -git add :/ -git commit -m "gh pages" - -ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key" -ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv" -ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} -ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} -openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ci/deploy_key.enc -out deploy_key -d -chmod 600 deploy_key -eval `ssh-agent -s` -ssh-add deploy_key - -git remote set-url origin git@github.com:LiveSplit/LiveSplitOne.git - -git push origin gh-pages -f