diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f34b32a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: ci +on: + push: + pull_request: + types: [opened, reopened] +jobs: + build: + name: build + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '10.x' + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + - run: npm ci + - run: npx lockfile-lint --type npm --path package-lock.json --validate-https --allowed-hosts npm + - run: npm run build + test: + name: test + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '10.x' + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + - run: npm ci + - run: npm run test-ci + - name: Submit test coverage to Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d6463c8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -sudo: required - -language: node_js -node_js: '10' -cache: npm - -notifications: - email: - recipients: - - formsg@data.gov.sg - on_success: always - on_failure: always - -before_script: - - npm install - -script: - - npm run test-ci - - npm build diff --git a/package.json b/package.json index d09bb16..0d86020 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "types": "./dist/index.d.ts", "scripts": { "test": "jest", - "test-ci": "jest --coverage && coveralls < coverage/lcov.info && rm -rf ./coverage", - "test:watch": "jest --watch", + "test-ci": "jest --coverage", + "test-watch": "jest --watch", "build": "tsc", "prepare": "npm run build" },