diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..4e48bf2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,50 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests. +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Build and lint + +on: + push: + branches: # Run actions when code is committed to these branches + - master + pull_request: + branches: # Run actions when a PR is pushed based on one of these branches + - master + +jobs: + checkout_and_test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - node-version: 8.x + lint: true # Linter is run only once to shorten the total build time + - node-version: 10.x + - node-version: 12.x + + steps: + - name: Checkout code from ${{ github.repository }} + uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: MongoDB in GitHub Actions + uses: supercharge/mongodb-github-action@1.3.0 + with: + mongodb-version: 3.4 + - name: Install dependencies + run: npm i + - name: Run linter + if: ${{ matrix.lint }} + run: make lint + - name: Create test config + run: cp config/test.sample.json config/test.json + - name: Start test app + run: NODE_ENV=test node index.js & + - name: Wait / Sleep + uses: jakejarvis/wait-action@v0.1.0 + with: + time: '10s' + - name: Run tests + run: make ci diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6f292b5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ - -# Language/versions -language: node_js -matrix: - include: - - node_js: '8' - - node_js: '10' - - node_js: '12' - -# Build only master (and pull-requests) -branches: - only: - - master - -# Services setup -services: - - mongodb - -# Build script -before_script: - - cp config/test.sample.json config/test.json - - NODE_ENV=test node index.js & - - sleep 5 # give server time to start -script: 'make ci'