From 860064cd51950e7b58369a862b4841ca0044c6dc Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 19 Sep 2019 12:52:26 +0300 Subject: [PATCH] Switch to GitHub Actions CI. --- .circleci/config.yml | 99 ---------------------------------- .github/workflows/test.yml | 106 +++++++++++++++++++++++++++++++++++++ README.md | 2 +- 3 files changed, 107 insertions(+), 100 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 37d6bdb4d..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,99 +0,0 @@ -version: 2.1 - -aliases: - - repo_cache_filename: &repo_cache_filename repo-{{ .Environment.CIRCLE_SHA1 }} - - &save_npm_cache - key: npm-deps-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }} - name: Save npm modules - paths: - - ~/.npm/ - - ./node_modules/ - - &restore_npm_cache - keys: - - npm-deps-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }} - - npm-deps-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }} - name: Restore npm modules - -_install: &install - steps: - - checkout - - save_cache: - key: *repo_cache_filename - name: Save repo - paths: - - ~/project/ - - restore_cache: *restore_npm_cache - - run: npm ci - - save_cache: *save_npm_cache - -_image: &image - docker: - - image: circleci/node:12 - -commands: - run-tests: - parameters: - test-commands: - description: "Steps that will be executed after the repo is cloned and dependencies are installed, but before tests are run" - type: steps - default: [] - steps: - - restore_cache: - key: *repo_cache_filename - name: Restore repo - - restore_cache: *restore_npm_cache - - run: node --version - - run: npm --version - - run: curl --silent https://v4.ifconfig.co/ - - steps: << parameters.test-commands >> - -jobs: - install: - <<: *image - <<: *install - - test: - <<: *image - steps: - - run-tests: - test-commands: - - run: - name: Run tests - command: npm run test-with-coverage - - run: - name: Run coveralls - command: npm run coveralls - when: on_success - - test-functional-debug: - <<: *image - steps: - - run-tests: - test-commands: - - run: - name: Run functional tests (debug) - command: npm run mocha:only-functional:dev - - test-functional-prod: - <<: *image - steps: - - run-tests: - test-commands: - - run: - name: Run functional tests (production) - command: npm run mocha:only-functional:prod - -workflows: - version: 2 - install-and-test: - jobs: - - install - - test: - requires: - - install - - test-functional-debug: - requires: - - install - - test-functional-prod: - requires: - - install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..0292f103a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,106 @@ +name: Tests +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node: [12] + os: [ubuntu-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v1 + with: + fetch-depth: 3 + + - name: Set Node.js version + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + - run: curl --silent https://v4.ifconfig.co/ + + - name: Install npm dependencies + run: npm ci + env: + CI: true + + - name: Run tests with coverage + run: npm run test-with-coverage + + - name: Run Coveralls + run: npm run coveralls + if: github.repository == 'MaxCDN/bootstrapcdn' && github.event_name == 'push' + env: + COVERALLS_REPO_TOKEN: "${{ secrets.COVERALLS_REPO_TOKEN }}" + COVERALLS_GIT_BRANCH: "${{ github.ref }}" + + test-functional-debug: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node: [12] + os: [ubuntu-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v1 + with: + fetch-depth: 3 + + - name: Set Node.js version + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + - run: curl --silent https://v4.ifconfig.co/ + + - name: Install npm dependencies + run: npm ci + env: + CI: true + + - name: Run functional tests (debug) + run: npm run mocha:only-functional:dev + + test-functional-prod: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node: [12] + os: [ubuntu-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v1 + with: + fetch-depth: 3 + + - name: Set Node.js version + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + - run: curl --silent https://v4.ifconfig.co/ + + - name: Install npm dependencies + run: npm ci + env: + CI: true + + - name: Run functional tests (production) + run: npm run mocha:only-functional:prod diff --git a/README.md b/README.md index 006153357..d89ef0832 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # BootstrapCDN [![Total alerts](https://img.shields.io/lgtm/alerts/g/MaxCDN/bootstrapcdn.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/MaxCDN/bootstrapcdn/alerts/) -[![Build Status](https://img.shields.io/circleci/project/github/MaxCDN/bootstrapcdn/develop.svg?style=flat-square)](https://circleci.com/gh/MaxCDN/bootstrapcdn) +[![Build Status](https://github.com/MaxCDN/bootstrapcdn/workflows/Tests/badge.svg)](https://github.com/MaxCDN/bootstrapcdn/actions) [![Coverage Status](https://img.shields.io/coveralls/github/MaxCDN/bootstrapcdn/develop.svg?style=flat-square)](https://coveralls.io/github/MaxCDN/bootstrapcdn) [![dependencies Status](https://img.shields.io/david/MaxCDN/bootstrapcdn.svg?style=flat-square)](https://david-dm.org/MaxCDN/bootstrapcdn) [![devDependencies Status](https://img.shields.io/david/dev/MaxCDN/bootstrapcdn.svg?style=flat-square)](https://david-dm.org/MaxCDN/bootstrapcdn?type=dev)