Setup stylelint #2864
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
| # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: Navigate - CI | |
| on: | |
| push: | |
| branches: ['main'] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: ['main'] | |
| env: | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm ui exec playwright install chromium | |
| - run: pnpm -r build | |
| - run: pnpm lint | |
| - run: pnpm -r test --watch false | |
| - name: Archive production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-artifact | |
| path: packages/ui/dist | |
| - name: Run BundleMon | |
| continue-on-error: true | |
| uses: lironer/bundlemon-action@v1 | |
| with: | |
| working-directory: 'packages/ui' | |
| e2e: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: nlsoftware | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - uses: pnpm/action-setup@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Add hosts to /etc/hosts | |
| run: | | |
| sudo echo "127.0.0.1 navigate.lucuma.xyz" | sudo tee -a /etc/hosts | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm e2e exec playwright install firefox | |
| - run: pnpm ui build | |
| - run: docker compose -f packages/e2e/docker-compose.yml up -d --wait | |
| env: | |
| LUCUMA_REFRESH_TOKEN: ${{ secrets.LUCUMA_DEV_API_KEY }} | |
| - name: Run Playwright tests | |
| run: pnpm e2e test:e2e | |
| env: | |
| LUCUMA_REFRESH_TOKEN: ${{ secrets.LUCUMA_DEV_API_KEY }} | |
| DATABASE_URL: 'postgresql://jimmy:banana@127.0.0.1:5432/configs' | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: packages/e2e/playwright-report/ | |
| retention-days: 30 | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| env: | |
| REGISTRY_USERNAME: 'nlsoftware' | |
| REGISTRY_IMAGE: noirlab/gpp-nav-configs | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Log in to the Container registry | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| - name: Set version | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| run: | | |
| cd packages/configs | |
| pnpm pkg set version="${VERSION:11}+$(date +'%Y%m%d').$(git rev-parse --short HEAD)" | |
| env: | |
| VERSION: ${{ github.ref }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| id: build | |
| with: | |
| context: . | |
| file: packages/configs/Dockerfile | |
| # Only push on releases | |
| push: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| load: true | |
| - name: Smoke test | |
| run: | | |
| echo "Smoke test for version ${CONFIGS_VERSION}" | |
| docker compose -f .github/docker-compose.yml up -d --no-build --wait | |
| ./packages/configs/tasks/healthcheck.js | |
| echo "Smoke test successful!" | |
| docker compose -f .github/docker-compose.yml down | |
| env: | |
| CONFIGS_VERSION: ${{ steps.meta.outputs.version }} | |
| DB_USER: jimmy | |
| DB_PASS: banana | |
| DB_NAME: configs | |
| publish-ui: | |
| name: Publish UI Artifacts | |
| needs: [check] | |
| if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | |
| runs-on: ubuntu-latest | |
| env: | |
| REGISTRY_USERNAME: 'nlsoftware' | |
| REGISTRY_IMAGE: noirlab/gpp-nav | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: dist-artifact | |
| path: packages/ui/dist | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: packages/ui | |
| # Only push on releases | |
| push: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy-server: | |
| environment: | |
| name: navigate-dev-gn | |
| url: https://navigate-dev.lucuma.xyz/ | |
| if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | |
| needs: [publish-ui] | |
| runs-on: ubuntu-latest | |
| env: | |
| REGISTRY_USERNAME: 'nlsoftware' | |
| REGISTRY_IMAGE: noirlab/gpp-nav | |
| HEROKU_APP_NAME: navigate-dev-gn | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Install Heroku CLI | |
| run: | | |
| curl https://cli-assets.heroku.com/install.sh | sh | |
| - name: Deploy | |
| env: | |
| HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
| run: ./deploy/deploy-heroku.sh | |
| deploy-configs: | |
| runs-on: ubuntu-latest | |
| environment: navigate-configs-dev-gn | |
| if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | |
| needs: [build-docker] | |
| env: | |
| REGISTRY_USERNAME: 'nlsoftware' | |
| REGISTRY_IMAGE: noirlab/gpp-nav-configs | |
| HEROKU_APP_NAME: navigate-configs-dev-gn | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Install Heroku CLI | |
| run: | | |
| curl https://cli-assets.heroku.com/install.sh | sh | |
| - name: Deploy | |
| env: | |
| HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
| run: ./deploy/deploy-heroku.sh |