From c195c187cc04155bbb2fa7e7f00a18d0e9edd371 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 11:21:58 -0600 Subject: [PATCH 1/8] Github Actions --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++ .travis.yml | 51 ---------------------------------------- README.md | 2 +- 3 files changed, 35 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..0a411c167 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: ci +on: + push: + branches: + - master + pull_request: + branches: + - '**' +jobs: + build: + runs-on: ubuntu-18.04 + env: + MONGODB_VERSION: 3.6.9 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '10.14' + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + path: ~/.npm + key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} + restore-keys: v1-npm-deps- + - run: npm ci + - run: npm install -g mongodb-runner + - run: mongodb-runner start + - run: npm run lint + - run: npm test -- --maxWorkers=4 + - run: npm run integration + env: + CI: true + - run: bash <(curl -s https://codecov.io/bash) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4ff1df130..000000000 --- a/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -language: node_js -dist: trusty -node_js: -- '10.14' -branches: - only: - - master - - "/^greenkeeper/.*$/" - - "/^v?[0-9]+.[0-9]+.[0-9]+(-.*)?$/" -cache: - directories: - - "$HOME/.npm" - - "$HOME/.mongodb/versions" -jobs: - include: - - stage: test - env: - - MONGODB_VERSION=3.6.9 - before_script: - - npm install -g mongodb-runner - - mongodb-runner start - script: - - npm run lint - - npm test -- --maxWorkers=4 - - npm run integration - after_script: "./node_modules/codecov/bin/codecov -f ./coverage/coverage-final.json - && rm -rf ./coverage" - - stage: release - env: - - - before_script: skip - after_script: skip - script: - - npm run release_docs - deploy: - - provider: pages - skip_cleanup: true - github_token: "$GITHUB_TOKEN" - local_dir: docs/ - on: - all_branches: true - - provider: npm - skip_cleanup: true - email: - secure: NGcEiR5Q9N2n83xRUTY9KjrirwE86/8CiLxfdheKVYGag454GXh8uPHZQzhv9p4taprx/nPxQtnyLdUOrlmbW9a5grA1j/QMxKmKw00AjkIMefOSCJ4n0penlz2JI7M746DPraUwiJ2/UZERwV5cQmJg4X3eNetEc68WmLQeeV1IV6/72vExA0zFWdb+eg6sP06ZyYLi9StO730LqnxPsvqQSRJbFn7RVgj8Jz9aRK2YnMT8pq6Vj7N56Pu9nnno4eytfNynlzNgubBHhF1Jl5dxW3VWoem5/B7ehxk2sgZgkgH53kFmZsePTu2gFwQHGVV/zl40/a2BDjsIm4Na0X52HEoPMEHUlemRVMXB3Sl9sglo72YpGAbIc3rYRsr23aJ2pUgXVGjuhdQqB9OH/UMWPmm9ZTtQg08nhBfOQDLvf7rHrScqPGk6pWJEMAXA4B09asFD1wcrMfdgs8uuPJ2DIzxSK4FMyfbJci5/G/BzojtQsOn/PGdLZ5HM7gHwUoZ8qYbv+sVtNl4vOXEAuyuOpm9i8OJZBG+BzVwAoXZeilJtHlt4LkZBhSKcLfWg+2V1t+VmOr4cnBHPLHOdSYTkI9zqyRgKDI3zbSszLQcuNVXDAsygI5/MbW+xEYiY8lllvfj3KTdXrTobJGL97A6egq9ZxtY6EOGbbMgUmkg= - api_key: - secure: dEvG8zO1GL6yEJkfcbpIE+PejmsKPgZsOY4xGxFtrCdDCk4qHTyO6qc9TwQ5m+LfajZuq9EGCyTj7mPcwOrwmLTmX+sEP8QcW6L08syUvQeXqSL28RM10e6i/aEeMzwLrEvh9MmJZhA1mvuQLGq8Sx6SPZHQaQvvOia2hwQaATI9EM+FO1+ieawSIctNvtqkWwvqHHYTDJcJvT8q5uxIf2b5vJj42j2+JLuMDxVKwc7khdO/k9JBpbd0YZptIL3SL4LfMIczKMH/bMwAarG/Cm6fggexPCyofJn7Oof9PBXgUMDUCgxYvHstLK1WbvbEeyA6DvJIoY3SYwmdEjjIUdasMLTJyHlpppntR8fMmEt71BpHJG2TcLOt/dk1BdAKdNOLZMODo/nhLNuxvC3ymB8N2ZfhFk8cGEfU2SdapRkA9RVYEt6mrXT0lJEJ2V/A1giRNzeYaUX69JzcnUACJlzmbxlyRESvawdWJI+/JzjROS0PJG8y9cpe8I+SwqbNi7NFk1lWnSmvcyjTM4fFMppPdz3rEaGBYY7S1NlMayG5PdCctxn6ZBC6snRDMEPL2W2FbOO275M+fiwJ9m5A6AWapeBADAzc7gRCobpXB2dQXrvFi+2X6ReHP09ecFzdJLVEt9VdPAPUij/0s9Mby219s731mFh/0zhdYAo8/fA= - on: - tags: true - all_branches: true - repo: parse-community/Parse-SDK-JS diff --git a/README.md b/README.md index c3b30dac8..88e2e8419 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Follow on Twitter Join the conversation License - Build status + Build status Backers on Open Collective Sponsors on Open Collective

From 29cbc8b64ea91f8373eea940d243e529c245dbc8 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 11:33:00 -0600 Subject: [PATCH 2/8] set timeout --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a411c167..772731c95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: jobs: build: runs-on: ubuntu-18.04 + timeout-minutes: 30 env: MONGODB_VERSION: 3.6.9 steps: From 1ed37a50df5e8c9c4859713e4234221a9b4dbbfb Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 12:29:06 -0600 Subject: [PATCH 3/8] Test gh-pages --- .github/workflows/ci.yml | 5 +++-- .github/workflows/pages.yml | 28 ++++++++++++++++++++++++++++ release_docs.sh | 10 +++++----- 3 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 772731c95..b4dc83967 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,9 @@ jobs: uses: actions/cache@v2 with: path: ~/.npm - key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} - restore-keys: v1-npm-deps- + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - run: npm install -g mongodb-runner - run: mongodb-runner start diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..67fc61217 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,28 @@ +name: docs +on: + push: + branches: + - master + pull_request: + branches: + - '**' +jobs: + build: + runs-on: ubuntu-18.04 + timeout-minutes: 30 + steps: + - name: Get Tag + id: tag + run: | + echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + - name: Generate Docs + run: | + echo $SOURCE_TAG + npm run release_docs + env: + SOURCE_TAG: ${{ steps.tag.outputs.SOURCE_TAG }} + - name: Deploy + uses: peaceiris/actions-gh-pages@v3.7.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs diff --git a/release_docs.sh b/release_docs.sh index 5c7b4c127..093619783 100755 --- a/release_docs.sh +++ b/release_docs.sh @@ -1,11 +1,11 @@ #!/bin/sh -e set -x -if [ "${TRAVIS_REPO_SLUG}" = "" ]; +if [ "${GITHUB_ACTIONS}" = "" ]; then - echo "Cannot release docs without TRAVIS_REPO_SLUG set" + echo "Cannot release docs without GITHUB_ACTIONS set" exit 0; fi -REPO="https://github.com/${TRAVIS_REPO_SLUG}" +REPO="https://github.com/parse-community/Parse-SDK-JS" rm -rf docs git clone -b gh-pages --single-branch $REPO ./docs @@ -15,9 +15,9 @@ cd .. DEST="master" -if [ "${TRAVIS_TAG}" != "" ]; +if [ "${SOURCE_TAG}" != "" ]; then - DEST="${TRAVIS_TAG}" + DEST="${SOURCE_TAG}" # change the default page to the latest echo "" > "docs/api/index.html" fi From d3c8397d83b565d3769dcd50c0521a8c35806ecc Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 12:32:16 -0600 Subject: [PATCH 4/8] Add checkout to pages --- .github/workflows/pages.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 67fc61217..9e0b2f757 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,6 +11,11 @@ jobs: runs-on: ubuntu-18.04 timeout-minutes: 30 steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '10.14' - name: Get Tag id: tag run: | From 0a345a680d1994a0ddfaa777e324330c2faaa455 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 12:46:18 -0600 Subject: [PATCH 5/8] Properly handle tags for pages --- .github/workflows/pages.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9e0b2f757..9c3d2e262 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -16,16 +16,23 @@ jobs: uses: actions/setup-node@v1 with: node-version: '10.14' + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Get Tag id: tag - run: | - echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + uses: dawidd6/action-get-tag@v1 - name: Generate Docs run: | echo $SOURCE_TAG + npm ci npm run release_docs env: - SOURCE_TAG: ${{ steps.tag.outputs.SOURCE_TAG }} + SOURCE_TAG: ${{ steps.tag.outputs.tag }} - name: Deploy uses: peaceiris/actions-gh-pages@v3.7.3 with: From ca8a8b8dcdef1a97d4b90557f87cc548e5e1e7ff Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 13:01:09 -0600 Subject: [PATCH 6/8] properly parse tag --- .github/workflows/pages.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 9c3d2e262..b53cab171 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -25,14 +25,22 @@ jobs: ${{ runner.os }}-node- - name: Get Tag id: tag - uses: dawidd6/action-get-tag@v1 + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + result-encoding: string + script: | + const ref = process.env.GITHUB_REF + if(!ref.startsWith('refs/tags/')) + return '' + return ref.replace(/^refs\/tags\//, '') - name: Generate Docs run: | echo $SOURCE_TAG npm ci npm run release_docs env: - SOURCE_TAG: ${{ steps.tag.outputs.tag }} + SOURCE_TAG: ${{ steps.tag.outputs.result }} - name: Deploy uses: peaceiris/actions-gh-pages@v3.7.3 with: From ee9862a209af17f3d5b72623a4a1eb3a6aa55636 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 13:04:22 -0600 Subject: [PATCH 7/8] lint yml --- .github/workflows/pages.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index b53cab171..c68d9190d 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -24,16 +24,16 @@ jobs: restore-keys: | ${{ runner.os }}-node- - name: Get Tag + uses: actions/github-script@v3 id: tag - - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - result-encoding: string - script: | - const ref = process.env.GITHUB_REF - if(!ref.startsWith('refs/tags/')) - return '' - return ref.replace(/^refs\/tags\//, '') + with: + github-token: ${{secrets.GITHUB_TOKEN}} + result-encoding: string + script: | + const ref = process.env.GITHUB_REF + if(!ref.startsWith('refs/tags/')) + return '' + return ref.replace(/^refs\/tags\//, '') - name: Generate Docs run: | echo $SOURCE_TAG From da02623b95166858b3a896b0eaf3cb036171b4e7 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 3 Dec 2020 13:09:58 -0600 Subject: [PATCH 8/8] Only deploy docs on master and tags --- .github/workflows/pages.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index c68d9190d..b9449a4d8 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -3,9 +3,8 @@ on: push: branches: - master - pull_request: - branches: - - '**' + tags: + - '*' jobs: build: runs-on: ubuntu-18.04