From 3829bdc402bd1d95a2a3b4f0ed892cec2cfb9590 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 30 Nov 2020 13:07:27 +0100 Subject: [PATCH] Add GitHub Actions --- .github/workflows/ci.yml | 99 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 85 ---------------------------------- README.md | 2 +- 3 files changed, 100 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..14ee0c3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,99 @@ +name: CI +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + lint-dockerfile: + name: Lint Dockerfile + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Run Hadolint Dockerfile Linter + uses: burdzwastaken/hadolint-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HADOLINT_ACTION_DOCKERFILE_FOLDER: extras/docker + + lint-markdown: + name: Lint Markdown + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Run Remark Markdown Linter + run: | + npm install + npm run lint:md + - name: Run Textlint Markdown Linter + run: npm run lint:text + + lint-code: + name: Lint JavaScript + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Run EsLint Node.js Linter + run: | + npm install + npm run lint + + unit-test: + name: Unit Tests + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 10.x + - 12.x + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: 'Install Node.js ${{ matrix.node-version }}' + uses: actions/setup-node@v1 + with: + node-version: '${{ matrix.node-version }}' + - name: 'Unit Tests with Node.js ${{ matrix.node-version }}' + run: | + docker network create --driver=bridge my-network + docker run -d -h mysql --net=my-network -p 3306:3306 --name mysql -v $(pwd)/test/mysql-data:/docker-entrypoint-initdb.d/:ro -e MYSQL_ROOT_PASSWORD=test mysql:5.7 + docker run -d --net=my-network -p 3000:3000 --name keyrock -e IDM_DB_USER=root -e IDM_DB_PASS=test -e DATABASE_HOST=mysql -e IDM_DB_PORT=3306 fiware/idm:7.5.1 + + npm install + npm test + + code-coverage: + name: Coveralls Code Coverage + runs-on: ubuntu-latest + needs: unit-test + steps: + - name: Git checkout + uses: actions/checkout@v2 + - name: 'Test Coverage with Node.js 12.x' + uses: actions/setup-node@v1 + with: + node-version: 12.x + - run: | + docker network create --driver=bridge my-network + docker run -d -h mysql --net=my-network -p 3306:3306 --name mysql -v $(pwd)/test/mysql-data:/docker-entrypoint-initdb.d/:ro -e MYSQL_ROOT_PASSWORD=test mysql:5.7 + docker run -d --net=my-network -p 3000:3000 --name keyrock -e IDM_DB_USER=root -e IDM_DB_PASS=test -e DATABASE_HOST=mysql -e IDM_DB_PORT=3306 fiware/idm:7.5.1 + + npm install + npm run test:coverage + - name: Push to Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8624c4d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,85 +0,0 @@ -branches: - only: - - master - -addons: - apt: - packages: - - build-essential - - python -services: - - docker - -jobs: - include: - - stage: test - name: "Unit Tests: Node 10" - language: node_js - sudo: required - dist: xenial - - node_js: - - "10" - - install: - - npm install - - before_install: - - docker pull fiware/idm:7.5.1 - - docker pull mysql:5.7 - - docker network create --driver=bridge my-network - - docker run -d -h mysql --net=my-network -p 3306:3306 --name mysql -v $(pwd)/test/mysql-data:/docker-entrypoint-initdb.d/:ro -e MYSQL_ROOT_PASSWORD=test mysql:5.7 - - docker run -d --net=my-network -p 3000:3000 --name keyrock -e IDM_DB_USER=root -e IDM_DB_PASS=test -e DATABASE_HOST=mysql -e IDM_DB_PORT=3306 fiware/idm:7.5.1 - - before_script: - - npm run lint - - after_script: - - npm run test:coveralls - - - stage: test - name: "Unit Tests: Node 12" - language: node_js - sudo: required - dist: xenial - - node_js: - - "12" - - install: - - npm install - - before_install: - - docker pull fiware/idm:7.5.1 - - docker pull mysql:5.7 - - docker network create --driver=bridge my-network - - docker run -d -h mysql --net=my-network -p 3306:3306 --name mysql -v $(pwd)/test/mysql-data:/docker-entrypoint-initdb.d/:ro -e MYSQL_ROOT_PASSWORD=test mysql:5.7 - - docker run -d --net=my-network -p 3000:3000 --name keyrock -e IDM_DB_USER=root -e IDM_DB_PASS=test -e DATABASE_HOST=mysql -e IDM_DB_PORT=3306 fiware/idm:7.5.1 - - before_script: - - npm run lint - - after_script: - - npm run test:coveralls - - - stage: test - name: "Documentation Tests" - language: node_js - - node_js: - - "10" - - install: - - npm install - - script: - - npm run lint:md - - npm run lint:text - - - stage: test - name: "Dockerfile Tests" - language: bash - before_script: - - docker pull hadolint/hadolint - script: - - docker run --rm -i hadolint/hadolint < ./extras/docker/Dockerfile diff --git a/README.md b/README.md index c53f9b1..bc03103 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Support badge](https://img.shields.io/badge/tag-fiware--wilma-orange.svg?logo=stackoverflow)](https://stackoverflow.com/questions/tagged/fiware-wilma)
[![Documentation badge](https://img.shields.io/readthedocs/fiware-pep-proxy.svg)](https://fiware-pep-proxy.readthedocs.io/en/latest/) -[![Build Status](https://travis-ci.org/ging/fiware-pep-proxy.svg?branch=master)](https://travis-ci.org/ging/fiware-pep-proxy) +[![CI](https://github.com/ging/fiware-pep-proxy/workflows/CI/badge.svg)](https://github.com/ging/fiware-pep-proxy/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/github/ging/fiware-pep-proxy/badge.svg?branch=master)](https://coveralls.io/github/ging/fiware-pep-proxy?branch=master) ![Status](https://nexus.lab.fiware.org/repository/raw/public/static/badges/statuses/wilma.svg) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4417/badge)](https://bestpractices.coreinfrastructure.org/projects/4417)