build: restore ci checks PLATTA-6231 #295
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: CI-Sports-Helsinki | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| # Only consider those paths to trigger the action | |
| paths: | |
| - 'apps/sports-helsinki/**' | |
| - 'packages/components/**' | |
| - 'packages/common-i18n/**' | |
| - '.yarnrc.yml' | |
| - 'tsconfig.base.json' | |
| - '.prettier*' | |
| - '.github/workflows/**' | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| # Only consider those paths to trigger the action | |
| paths: | |
| - 'apps/sports-helsinki/**' | |
| - 'packages/components/**' | |
| - 'packages/common-i18n/**' | |
| - '.yarnrc.yml' | |
| - 'tsconfig.base.json' | |
| - '.prettier*' | |
| - '.github/workflows/**' | |
| env: | |
| CI: true | |
| FEDERATION_ROUTER_ENDPOINT: https://events-graphql-federation-sports.test.hel.ninja/ | |
| CMS_ORIGIN: https://liikunta.app-staging.hkih.hion.dev | |
| LINKEDEVENTS_EVENT_ENDPOINT: https://api.hel.fi/linkedevents/v1/event | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # Why not using setup-node 2.2+ cache option (yet) ? | |
| # see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
| - name: Restore yarn cache | |
| uses: actions/cache@v4 | |
| id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} | |
| restore-keys: | | |
| yarn-cache-folder- | |
| # see https://github.com/vercel/next.js/pull/27362 | |
| - name: Restore nextjs build sports-helsinki from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ github.workspace }}/apps/sports-helsinki/.next/cache | |
| ${{ github.workspace }}/.cache | |
| ${{ github.workspace }}/**/tsconfig.tsbuildinfo | |
| key: ${{ runner.os }}-sports-helsinki-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('apps/sports-helsinki/src/**.[jt]sx?', 'apps/sports-helsinki/src/**.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-sports-helsinki-${{ hashFiles('**/yarn.lock') }}- | |
| - name: Install dependencies | |
| run: | | |
| yarn install --immutable --inline-builds | |
| env: | |
| HUSKY: 0 | |
| - name: Typecheck | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn typecheck | |
| - name: Linter | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn lint | |
| - name: Unit tests | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn test --coverage | |
| env: | |
| TZ: Europe/Helsinki | |
| FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}} | |
| CMS_ORIGIN: ${{env.CMS_ORIGIN}} | |
| LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}} | |
| # Mock origin | |
| NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001 | |
| - name: SonarQube Cloud Scan | |
| uses: SonarSource/sonarqube-scan-action@v5.1.0 | |
| with: | |
| projectBaseDir: apps/sports-helsinki | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| - name: Build web-app | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn build | |
| env: | |
| # Speed up build: they are linted in a previous step | |
| NEXTJS_IGNORE_ESLINT: true | |
| # Speed up build: they are typechecked in a previous step | |
| NEXTJS_IGNORE_TYPECHECK: true | |
| # Speed up build: don't run if not needed, enable if it becomes needed | |
| NEXT_DISABLE_SOURCEMAPS: true | |
| # Don't send telemetry for ci | |
| NEXT_TELEMETRY_DISABLED: true | |
| # To allow checking size-limits | |
| NEXTJS_DISABLE_SENTRY: false | |
| # Fully disable sentry upload | |
| NEXTJS_SENTRY_UPLOAD_DRY_RUN: true | |
| FEDERATION_ROUTER_ENDPOINT: ${{env.FEDERATION_ROUTER_ENDPOINT}} | |
| CMS_ORIGIN: ${{env.CMS_ORIGIN}} | |
| LINKEDEVENTS_EVENT_ENDPOINT: ${{env.LINKEDEVENTS_EVENT_ENDPOINT}} | |
| # Mock origin | |
| NEXT_PUBLIC_APP_ORIGIN: https://localhost:3001 | |
| NEXT_PUBLIC_MATOMO_URL_BASE: '//webanalytics.digiaiiris.com/js/' | |
| NEXT_PUBLIC_MATOMO_SITE_ID: 939 | |
| NEXT_PUBLIC_MATOMO_SRC_URL: 'piwik.min.js' | |
| NEXT_PUBLIC_MATOMO_TRACKER_URL: 'tracker.php' | |
| NEXT_PUBLIC_MATOMO_ENABLED: 0 | |
| - name: Check browser bundle size limits | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn check-size | |
| - name: Check ecmascript checks for build files | |
| working-directory: apps/sports-helsinki | |
| run: | | |
| yarn check-dist |