From 743faa8eca03058aa075255b8b09de2445f348da Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sat, 19 Oct 2019 17:32:14 +0200 Subject: [PATCH] Enable Github Actions in place of Travis (#11447) * add apidoc * rename, copy config * add client unit tests * add more tests * fix client tests * fix client tests * add api tests * fix names * remove travis * enable github actions on pull requests * shallow clone * add badge --- .github/workflows/lint.yml | 22 ----- .github/workflows/test.yml | 198 +++++++++++++++++++++++++++++++++++++ .travis.yml | 29 ------ README.md | 2 +- 4 files changed, 199 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 3c030d278e..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Node CI - -on: [push] - -jobs: - lint: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [12.x] - steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: npm install - run: | - npm ci - env: - CI: true - - run: npm run lint \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..3ee78e4dc1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,198 @@ +name: Test + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run lint + apidoc: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run apidoc + sanity: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:sanity + + common: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:common + content: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:content + + api-unit: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: sudo docker run --name mongo -d -p 27017:27017 mongo + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:api:unit + env: + REQUIRES_SERVER=true: true + api-v3-integration: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: sudo docker run --name mongo -d -p 27017:27017 mongo + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:api-v3:integration + env: + REQUIRES_SERVER=true: true + api-v4-integration: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: sudo docker run --name mongo -d -p 27017:27017 mongo + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:api-v4:integration + env: + REQUIRES_SERVER=true: true + + client-unit: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cp config.json.example config.json + - name: npm install + run: | + npm ci + env: + CI: true + - run: npm run test:unit + working-directory: ./website/client \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a378d70294..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: node_js -node_js: - - '12' -services: - - mongodb -cache: - directories: - - 'node_modules' -addons: - chrome: stable -before_script: - - npm run test:build - - cp config.json.example config.json - - sleep 5 -script: - - npm run $TEST -env: - global: - - DISABLE_REQUEST_LOGGING=true - matrix: - - TEST="lint" - - TEST="test:api:unit" REQUIRES_SERVER=true COVERAGE=true - - TEST="test:api-v3:integration" REQUIRES_SERVER=true COVERAGE=true - - TEST="test:api-v4:integration" REQUIRES_SERVER=true COVERAGE=true - - TEST="test:sanity" - - TEST="test:content" COVERAGE=true - - TEST="test:common" COVERAGE=true - - TEST="client:unit" COVERAGE=true - - TEST="apidoc" diff --git a/README.md b/README.md index 3437bf8a36..d5466acdc1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Habitica [![Build Status](https://travis-ci.org/HabitRPG/habitica.svg?branch=develop)](https://travis-ci.org/HabitRPG/habitica) [![Code Climate](https://codeclimate.com/github/HabitRPG/habitrpg.svg)](https://codeclimate.com/github/HabitRPG/habitrpg) [![Bountysource](https://api.bountysource.com/badge/tracker?tracker_id=68393)](https://www.bountysource.com/trackers/68393-habitrpg?utm_source=68393&utm_medium=shield&utm_campaign=TRACKER_BADGE) [![Open Source Helpers](https://www.codetriage.com/habitrpg/habitica/badges/users.svg)](https://www.codetriage.com/habitrpg/habitica) +Habitica ![Build Status](https://github.com/HabitRPG/habitica/workflows/Test/badge.svg) [![Code Climate](https://codeclimate.com/github/HabitRPG/habitrpg.svg)](https://codeclimate.com/github/HabitRPG/habitrpg) [![Bountysource](https://api.bountysource.com/badge/tracker?tracker_id=68393)](https://www.bountysource.com/trackers/68393-habitrpg?utm_source=68393&utm_medium=shield&utm_campaign=TRACKER_BADGE) [![Open Source Helpers](https://www.codetriage.com/habitrpg/habitica/badges/users.svg)](https://www.codetriage.com/habitrpg/habitica) =============== [![Greenkeeper badge](https://badges.greenkeeper.io/HabitRPG/habitica.svg)](https://greenkeeper.io/)