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 65ef963..0000000 Binary files a/ci/deploy_key.enc and /dev/null differ diff --git a/ci/deploy_key.pub b/ci/deploy_key.pub deleted file mode 100644 index 7525a4a..0000000 --- a/ci/deploy_key.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOz2jNbj/6ejE+G17XwCeQCrWOuWa6Mr2+QJIbQhtZ29oGubA7yd0mWzqPa9ZC3in9CPqJPeIyzsQhoXJ+EkkFZ1TZi+rlyKiWk/u5YoHRZVEgIBa85wL7n4zIiIva5Jgn5W1wt/Xqd38Xe+JNfcsLjMzy3BfiGoxWuvQsSfTyjamfKqJ49MwSn/70y6La7HR3HYTSAjMOt5yXw2Vo4BPi87RrU23dqVqw70GIlqnBYMOGg+DL3IYA+R1VKwf1KgIfSTtP+oCOk/99Rj+3+KTynEeyirF1m+rlrSf7pv8Wg3bU/hqLVFnlh9t2VCGO4wS9RWjJC6PcEw9VRoAsLhUB8BjGaVKbiMZzOyEQ4XXutD6wM1SorNkaPeQQ4m/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