diff --git a/.github/workflows/ngx-clipboard.yml b/.github/workflows/ngx-clipboard.yml new file mode 100644 index 0000000..9ff6bdd --- /dev/null +++ b/.github/workflows/ngx-clipboard.yml @@ -0,0 +1,47 @@ +name: ngx-clipboard + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v1 + id: yarn-cache + with: + path: node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn + + - uses: actions/setup-node@v1 + with: + node-version: 12.12 + + - name: Install dependencies + if: steps.yarn-cache.outputs.cache-hit != 'true' + run: yarn --pure-lockfile --non-interactive --no-progress + + # Fix linting errors first + # - name: Run TSLint + # run: yarn lint + + - name: Run tests + run: yarn test --configuration=ci + + - name: Build integration app + run: yarn build --prod + + - name: Build library + run: yarn build + + - name: Publish library + if: github.event_name == 'workflow_dispatch' + run: yarn publish:lib diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4a95319..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -sudo: required -dist: trusty -language: node_js -node_js: - - '8' - -addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable - -cache: - directories: - - node_modules - -branches: - only: - - master - -notifications: - email: false - -install: - - yarn - -script: - - npm run test -- --watch=false --progress=false --browsers=ChromeHeadlessCI - - npm run build - -after_success: - - npm publish:lib diff --git a/angular.json b/angular.json index a0e71a4..32099b6 100644 --- a/angular.json +++ b/angular.json @@ -135,6 +135,13 @@ "main": "projects/ngx-clipboard/src/test.ts", "tsConfig": "projects/ngx-clipboard/tsconfig.spec.json", "karmaConfig": "projects/ngx-clipboard/karma.conf.js" + }, + "configurations": { + "ci": { + "watch": false, + "progress": false, + "browsers": "ChromeHeadlessCI" + } } }, "lint": { diff --git a/package.json b/package.json index 9823122..be241d9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "ng": "ng", "prettier": "prettier --write \"**/*.{json,md,ts,html,component.html}\"", "start": "ng serve", - "build": "ng build ngx-clipboard --prod && npm run build-copy", + "build": "ng build ngx-clipboard --prod && yarn build-copy", "tslint-check": "tslint-config-prettier-check ./tslint.json", "test": "ng test ngx-clipboard", "test:watch": "ng test ngx-clipboard --watch",