From 7f421737e009cfb28cf9447c64ac2f326aed54c8 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Wed, 25 Nov 2020 15:05:24 -0800 Subject: [PATCH] Migrate CI to Github Actions (#1235) --- .github/workflows/test.yml | 33 ++++++++++++++++++++++++++++ .github/workflows/website.yml | 41 +++++++++++++++++++++++++++++++++++ .travis.yml | 23 -------------------- 3 files changed, 74 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/website.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..67a4798b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: test + +# On every pull request, but only on push to master +on: + push: + branches: + - master + pull_request_target: + +jobs: + test-node: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '12.x' + + - name: Install dependencies + run: | + yarn bootstrap + + - name: Run tests + run: | + yarn test ci + + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000..ee5d05ee --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,41 @@ +name: website + +on: + push: + branches: + - '*-release' + +jobs: + publish-website: + runs-on: ubuntu-latest + + if: github.repository_owner == 'visgl' + + env: + MapboxAccessToken: ${{ secrets.MAPBOX_ACCESS_TOKEN }} + + steps: + - uses: actions/checkout@v2.1.1 + + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '12.x' + + - name: Get version + id: get-version + run: LATEST=$(npm show react-map-gl version | grep -o -E "^[0-9]+\.[0-9]+") && echo "::set-output name=latest::/${LATEST}-release" + + - name: Check version + if: ${{ !endsWith(github.ref, steps.get-version.outputs.latest) }} + run: | + echo "Website is only published from the latest release branch" + + - name: Build & deploy website + if: ${{ endsWith(github.ref, steps.get-version.outputs.latest) }} + run: | + yarn bootstrap + cd website + yarn + yarn build + yarn deploy diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5f97cf3a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: node_js -os: linux -sudo: required -dist: trusty -addons: - apt: - packages: - - mesa-utils - - xvfb - - libgl1-mesa-dri - - libglapi-mesa - - libosmesa6 - - libxi-dev -node_js: - - '10' -install: - - yarn bootstrap -before_script: - - export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start -script: - - npm run test ci -after_success: - - cat coverage/lcov.info | coveralls