Merge pull request #300 from letehaha/feat/improvements #471
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint, Test and Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
prepare-dependencies: | |
name: Prepare local deps | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
- id: prepare-env | |
uses: ./.github/actions/prepare-local-env | |
- name: Install dependencies | |
if: steps.prepare-env.outputs.cache-hit != 'true' | |
run: npm ci | |
lint: | |
name: Lint source code | |
needs: prepare-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
- uses: ./.github/actions/prepare-local-env | |
- name: Lint source code | |
run: npm run lint | |
unit-tests: | |
name: Unit testing | |
needs: prepare-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
- uses: ./.github/actions/prepare-local-env | |
- name: Unit testing | |
run: npm run test:unit | |
build: | |
name: Build source code | |
needs: prepare-dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
- uses: ./.github/actions/prepare-local-env | |
- name: Build source code | |
run: npm run build | |
# integration-tests: | |
# name: Integration testing | |
# needs: prepare-dependencies | |
# runs-on: ubuntu-latest | |
# Disabled for now because when running in parallel, GitHub setups different | |
# machines with different chrome-browsers installed. That causes Cypress errors | |
# When trying to run in the cypress Docker container, there's no access to "sudo" | |
# to patch hosts file | |
# strategy: | |
# # when one test fails, DO NOT cancel the other | |
# # containers, because this will kill Cypress processes | |
# # leaving Cypress Cloud hanging ... | |
# # https://github.com/cypress-io/github-action/issues/48 | |
# fail-fast: false | |
# matrix: | |
# # Run tests in parallel | |
# containers: [1, 2, 3] | |
# container: | |
# # Using Docker container because of the issue with parallelization: | |
# # https://github.com/cypress-io/github-action/blob/master/README.md#parallel | |
# # see browsers tags here: https://hub.docker.com/r/cypress/browsers/tags | |
# image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1 | |
# options: --user 1001 | |
# steps: | |
# - name: Checkout repository and submodules | |
# uses: actions/checkout@v2 | |
# with: | |
# submodules: recursive | |
# token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
# - uses: ./.github/actions/prepare-local-env | |
# - name: Run Cypress e2e tests | |
# uses: cypress-io/github-action@v6 | |
# with: | |
# start: npm run dev | |
# wait-on: http://budget-tracker.com:8100 | |
# install: false | |
# config-file: cypress.config.ts | |
# browser: chrome | |
# quiet: true | |
# record: true | |
# # parallel: true | |
# group: Cypress tests | |
# env: | |
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# # Recommended: pass the GitHub token lets this action correctly | |
# # determine the unique run id necessary to re-run the checks | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# BASE_URL: http://budget-tracker.com:8100 | |
# PORT: 8100 | |
# HOST: budget-tracker.com | |
# VITE_APP_API_HTTP: https://${{ secrets.API_HOST_PROD }} | |
# VITE_APP_API_VER: ${{ secrets.VUE_APP_API_VER }} | |
docker-build: | |
name: Build source code using Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }} | |
- id: docker-build | |
uses: ./.github/actions/docker-build | |
with: | |
vps-host: ${{ secrets.VPS_HOST }} | |
vue-app-api-ver: ${{ secrets.VUE_APP_API_VER }} | |
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Image digest | |
run: echo ${{ steps.docker-build.outputs.docker-build-digest }} |