From 20f2fd1080c520dc2b821cf664b9d72ab7ffaaad Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 12 Dec 2020 21:29:25 +0100 Subject: [PATCH 1/3] Created workflow for ci in github actions --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 44 ------------------------------ Dockerfile | 2 +- docker-compose.yml | 2 +- 4 files changed, 61 insertions(+), 46 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 00000000..76f71ab5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: Continuous integration + +on: + pull_request: null + push: + branches: + - main + +jobs: + lint: + continue-on-error: true + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Use node.js 14.15 + uses: actions/setup-node@v1 + with: + node-version: 14.15 + - run: npm ci + - run: npm run lint + + unit-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Use node.js 14.15 + uses: actions/setup-node@v1 + with: + node-version: 14.15 + - run: npm ci + - run: npm run test:ci + - run: node_modules/.bin/ocular coverage/clover.xml + + mutation-tests: + continue-on-error: true + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Use node.js 14.15 + uses: actions/setup-node@v1 + with: + node-version: 14.15 + - run: npm ci + - run: echo "Building commit range ${TRAVIS_COMMIT_RANGE}" + - run: MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/main} --name-only | grep -E 'src\/(.*).(ts|tsx)$' | paste -sd ",") npm run mutate:ci + + build-docker-image: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + version: latest + - run: docker build -t shlink-web-client:test . diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 555c6212..00000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -dist: bionic - -language: node_js - -branches: - only: - - /.*/ - -cache: - directories: - - node_modules - -node_js: - - '14.15.0' - -jobs: - fast_finish: true - allow_failures: - - name: 'Lint' - - name: 'Mutation tests' - include: - - - name: 'Lint' - install: npm ci - script: npm run lint - - - name: 'Unit tests' - install: npm ci - script: npm run test:ci - after_success: - - node_modules/.bin/ocular coverage/clover.xml - - - name: 'Mutation tests' - install: npm ci - before_script: - - echo "Building commit range ${TRAVIS_COMMIT_RANGE}" - - export MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/main} --name-only | grep -E 'src\/(.*).(ts|tsx)$' | paste -sd ",") - script: npm run mutate:ci - - - name: 'Build docker image' - services: - - docker - install: skip - script: docker build -t shlink-web-client:test . diff --git a/Dockerfile b/Dockerfile index e73f9b1a..4b3d36de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.15.0-alpine as node +FROM node:14.15-alpine as node COPY . /shlink-web-client ARG VERSION="latest" ENV VERSION ${VERSION} diff --git a/docker-compose.yml b/docker-compose.yml index fe8ed153..945494d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: shlink_web_client_node: container_name: shlink_web_client_node - image: node:14.15.0-alpine + image: node:14.15-alpine command: /bin/sh -c "cd /home/shlink/www && npm install && npm run start" volumes: - ./:/home/shlink/www From 058860737e759de8c3494fccaba3af18320fb710 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 12 Dec 2020 21:39:51 +0100 Subject: [PATCH 2/3] Removed travis-specific env vars from github action --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76f71ab5..c519ed67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,7 @@ jobs: with: node-version: 14.15 - run: npm ci - - run: echo "Building commit range ${TRAVIS_COMMIT_RANGE}" - - run: MUTATION_FILES=$(git diff ${TRAVIS_COMMIT_RANGE:-origin/main} --name-only | grep -E 'src\/(.*).(ts|tsx)$' | paste -sd ",") npm run mutate:ci + - run: MUTATION_FILES=$(git diff origin/main --name-only | grep -E 'src\/(.*).(ts|tsx)$' | paste -sd ",") npm run mutate:ci build-docker-image: runs-on: ubuntu-latest From 7a1b6367a89b7e3884db59805f716f99be48eb7c Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 12 Dec 2020 21:43:16 +0100 Subject: [PATCH 3/3] Changed build badges to point to github action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d88b42c..f36813c7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # shlink-web-client -[![Build Status](https://img.shields.io/travis/com/shlinkio/shlink-web-client.svg?style=flat-square)](https://travis-ci.com/shlinkio/shlink-web-client) +[![Build Status](https://img.shields.io/github/workflow/status/shlinkio/shlink/Continuous%20integration/main?style=flat-square)](https://github.com/shlinkio/shlink-web-client/actions?query=workflow%3A%22Continuous+integration%22) [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/shlinkio/shlink-web-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-web-client/) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/shlinkio/shlink-web-client.svg?style=flat-square)](https://scrutinizer-ci.com/g/shlinkio/shlink-web-client/) [![GitHub release](https://img.shields.io/github/release/shlinkio/shlink-web-client.svg?style=flat-square)](https://github.com/shlinkio/shlink-web-client/releases/latest)