From 44f4ee4bf46ac36aff04cfca3a527f5ed73d7d7b Mon Sep 17 00:00:00 2001 From: VictorVelarde Date: Mon, 8 Feb 2021 20:11:28 +0100 Subject: [PATCH] feat: add ci with cypress run for both web apps --- .github/workflows/ci.yml | 53 +++++++++++++++++++ .gitignore | 5 +- template-sample-app/template/package.dev.json | 3 ++ template-skeleton/template/package.dev.json | 3 ++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..909a9ea8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: CI + +on: [push] + +jobs: + test-sample-app: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cd template-sample-app/template + - run: cp package.dev.json package.json + - run: npm install -g yarn + - run: yarn + - run: yarn lint + - run: yarn build + - run: yarn cy:ci + env: + CI: true + +test-skeleton-app: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: cd template-skeleton/template + - run: cp package.dev.json package.json + - run: npm install -g yarn + - run: yarn + - run: yarn lint + - run: yarn build + - run: yarn cy:ci + env: + CI: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4897c628..6645733d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,7 @@ firebase-debug.log* firebase-debug.*.log* # Firebase cache -.firebase/ \ No newline at end of file +.firebase/ +template-sample-app/template/cypress/videos/config.js.mp4 +template-sample-app/template/cypress/videos/home_page_spec.js.mp4 +template-sample-app/template/cypress/videos/kpi_page_spec.js.mp4 diff --git a/template-sample-app/template/package.dev.json b/template-sample-app/template/package.dev.json index 18b7e14c..8d961841 100644 --- a/template-sample-app/template/package.dev.json +++ b/template-sample-app/template/package.dev.json @@ -33,6 +33,7 @@ "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", "firebase-tools": "^9.2.2", + "start-server-and-test": "^1.12.0", "husky": "^4.3.8", "hygen": "^6.0.4", "lint-staged": "^10.5.3", @@ -45,6 +46,8 @@ "build": "react-app-rewired build", "test": "react-app-rewired test", "cypress": "npx cypress open", + "cy:run": "npx cypress run", + "cy:ci": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start https-get://localhost:3000 cy:run", "eject": "react-scripts eject", "lint": "eslint './src/**/*.{js,jsx}'", "lint:fix": "eslint './src/**/*.{js,jsx}' --fix", diff --git a/template-skeleton/template/package.dev.json b/template-skeleton/template/package.dev.json index 18b7e14c..8d961841 100644 --- a/template-skeleton/template/package.dev.json +++ b/template-skeleton/template/package.dev.json @@ -33,6 +33,7 @@ "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", "firebase-tools": "^9.2.2", + "start-server-and-test": "^1.12.0", "husky": "^4.3.8", "hygen": "^6.0.4", "lint-staged": "^10.5.3", @@ -45,6 +46,8 @@ "build": "react-app-rewired build", "test": "react-app-rewired test", "cypress": "npx cypress open", + "cy:run": "npx cypress run", + "cy:ci": "START_SERVER_AND_TEST_INSECURE=1 start-server-and-test start https-get://localhost:3000 cy:run", "eject": "react-scripts eject", "lint": "eslint './src/**/*.{js,jsx}'", "lint:fix": "eslint './src/**/*.{js,jsx}' --fix",