Merge pull request #200 from letehaha/feat/unify-transactions-and-acc… #209
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 | |
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@v4 | |
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 | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to detect new build vs re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BASE_URL: http://budget-tracker.com:8100 | |
PORT: 8100 | |
HOST: budget-tracker.com | |
VITE_APP_API_HTTP: http://${{ secrets.VPS_HOST }}:8081 | |
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 }} |