From 0e1862317ff62e92f29d1079b67b740fd6f62891 Mon Sep 17 00:00:00 2001 From: Randy Schott <1815175+schottra@users.noreply.github.com> Date: Mon, 11 Jan 2021 13:59:50 -0800 Subject: [PATCH] ci: migrate test/lint to GH actions (#136) * ci: migrate test/lint to GH actions * ci: fix typo * ci: fix node version to 12 * ci: tweaks for codecov --- .github/workflows/pull_request.yml | 33 ++++++++++++++++++++++++++++++ .travis.yml | 20 ------------------ Makefile | 6 +----- package.json | 1 - 4 files changed, 34 insertions(+), 26 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 287887e81..5fdaa1602 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -2,10 +2,43 @@ name: Pull Request on: pull_request jobs: + unit_tests_with_coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # We need history for codecov to work correctly + fetch-depth: 0 + - uses: actions/setup-node@v2 + with: + node-version: '12' + - uses: bahmutov/npm-install@v1 + - name: Run tests and generate coverage + run: make test_unit_codecov + - uses: codecov/codecov-action@v1 + with: + files: .coverage/coverage-final.json + fail_ci_if_error: true + + lint_project: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '12' + - uses: bahmutov/npm-install@v1 + - name: Run linter + run: make lint + test_image_build: name: Test build Docker image runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '12' + - uses: bahmutov/npm-install@v1 - name: Build image run: docker build . diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6b5df78c9..000000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -sudo: required -language: node_js -node_js: 10 -services: -- docker -cache: yarn -jobs: - include: -# - stage: test -# name: docker build and push -# install: true -# script: make dockerhub_push - - stage: test - name: unit tests - install: make install_ci - script: make test_unit_codecov - - stage: test - install: make install - name: lint - script: make lint diff --git a/Makefile b/Makefile index 2823cad2a..93faabab9 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,6 @@ update_boilerplate: install: #installs dependencies yarn -.PHONY: install_ci -install_ci: install - yarn add codecov - .PHONY: lint lint: #lints the package for common code smells yarn run lint @@ -40,4 +36,4 @@ clean: # submits the coverage to codecov.io .PHONY: test_unit_codecov test_unit_codecov: - yarn run test-coverage && yarn run codecov + yarn run test-coverage diff --git a/package.json b/package.json index 835b95ea2..ef2877d9f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "build:prod": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' NODE_ENV=production webpack --config webpack.config.ts --mode=production", "build": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' webpack --config webpack.config.ts --mode=development", "clean": "rm -rf dist", - "codecov": "codecov -f .coverage/coverage-final.json", "lint": "eslint . --ext .js,.ts,.tsx", "lint-fix": "eslint . --ext .js,.ts,.tsx --fix", "mockApi": "node ./mockApi",