add localbuild env for local deployment and changed build args #20
Workflow file for this run
This file contains hidden or 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: Frontend_Unit_Tests_and_SonarCloud_Analysis | |
| env: | |
| SONAR_ORGANIZATION_KEY: 'appsfactory' | |
| SONAR_PROJECT_KEY: 'appsfactory_project-metadata-platform-frontend' | |
| defaults: | |
| run: | |
| working-directory: src/frontend | |
| on: | |
| push: | |
| paths: | |
| - 'src/frontend/**' | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| install: | |
| name: Install Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # https://github.com/actions/setup-node/issues/899 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: | | |
| npm install -g corepack | |
| corepack enable | |
| yarn install --immutable | |
| style_check: | |
| name: Style Checking (Prettier) | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Run Prettier Check | |
| run: npx prettier --check . | |
| type_check: | |
| name: Type Checking (TypeScript) | |
| runs-on: ubuntu-latest | |
| needs: style_check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Run Type Check | |
| run: | | |
| corepack enable | |
| yarn type-check | |
| lint_check: | |
| name: Lint Checking (ESLint) | |
| runs-on: ubuntu-latest | |
| needs: type_check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Run Lint Check | |
| run: | | |
| corepack enable | |
| yarn lint:check . | |
| unit_tests_and_sonar: | |
| name: Unit Tests, Coverage & SonarCloud | |
| runs-on: ubuntu-latest | |
| needs: lint_check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Run tests and collect coverage | |
| run: | | |
| corepack enable | |
| yarn coverage | |
| - name: SonarCloud Scan | |
| uses: SonarSource/sonarqube-scan-action@master | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| -Dsonar.organization=${{ env.SONAR_ORGANIZATION_KEY }} | |
| -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} | |
| -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info | |
| -Dsonar.sources=src/frontend/src | |
| -Dsonar.exclusions=**/__tests__/**,**/__mocks__/**,**/*.spec.ts,**/*.test.ts,**/generated/** | |
| integration_test: | |
| name: Integration Tests (Cypress) | |
| runs-on: ubuntu-latest | |
| needs: unit_tests_and_sonar | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: setup corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'src/frontend/yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Cypress run | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: yarn preview --host 127.0.0.1 --port 8080 | |
| wait-on: 'http://127.0.0.1:8080' | |
| command: npx cypress run --headless --e2e | |
| build: yarn build | |
| working-directory: src/frontend |