Update GraphQL packages (#1702) #2375
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: Lucuma-TS - CI | |
| on: | |
| push: | |
| branches: ['main'] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: ['main'] | |
| concurrency: | |
| group: ${{ github.workflow }} @ ${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Diff base for pnpm --filter change detection | |
| CHANGED_SINCE: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && github.event.before || 'origin/main' }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present codegen | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present build | |
| - name: Archive production artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist-artifact | |
| path: packages/ui/dist | |
| - name: Run BundleMon on Navigate | |
| continue-on-error: true | |
| uses: lironer/bundlemon-action@v1 | |
| with: | |
| working-directory: 'packages/ui' | |
| bundlemon-args: --subProject "navigate-ui" | |
| - name: Run BundleMon on Resource | |
| continue-on-error: true | |
| uses: lironer/bundlemon-action@v1 | |
| with: | |
| working-directory: 'packages/resource-ui' | |
| bundlemon-args: --subProject "resource-ui" | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present codegen | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present generate | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]" --if-present lint:eslint | |
| - run: pnpm lint | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - run: pnpm exec playwright install chromium --only-shell | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present codegen | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present generate | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]" --if-present test | |
| e2e: | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v4 | |
| with: | |
| username: nlsoftware | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Add hosts to /etc/hosts | |
| run: | | |
| sudo echo "127.0.0.1 navigate.lucuma.xyz" | sudo tee -a /etc/hosts | |
| - run: pnpm exec playwright install firefox --only-shell | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present build | |
| - run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present e2e:docker-up | |
| env: | |
| LUCUMA_REFRESH_TOKEN: ${{ secrets.LUCUMA_DEV_API_KEY }} | |
| - name: Run Playwright tests | |
| run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]..." --if-present 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@v7 | |
| 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@v7 | |
| - uses: ./.github/setup | |
| with: | |
| install-deps: false | |
| - name: Log in to the Container registry | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| - name: Set version | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| run: | | |
| cd packages/configs | |
| npm 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@v7 | |
| 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 | |
| provenance: false | |
| - name: Smoke test | |
| run: | | |
| echo "Smoke test for version ${CONFIGS_VERSION}" | |
| docker compose -f .github/docker-compose.yml up -d --no-build --wait | |
| 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 | |
| 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@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ env.REGISTRY_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - run: pnpm ui codegen | |
| - run: pnpm ui build | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v7 | |
| 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 | |
| provenance: false | |
| 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: [build-docker, 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@v7 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v4 | |
| 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, publish-ui] | |
| env: | |
| REGISTRY_USERNAME: 'nlsoftware' | |
| REGISTRY_IMAGE: noirlab/gpp-nav-configs | |
| HEROKU_APP_NAME: navigate-configs-dev-gn | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v4 | |
| 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 | |
| # Detects whether resource-ui (or a dependency) changed in this push and exposes it as a job output | |
| resource-changes: | |
| runs-on: ubuntu-latest | |
| if: (github.ref == 'refs/heads/main' && github.repository_owner == 'gemini-hlsw') | |
| timeout-minutes: 10 | |
| outputs: | |
| should_deploy: ${{ steps.detect.outputs.should_deploy }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - id: detect | |
| run: pnpm --filter "...[${{ env.CHANGED_SINCE }}]" --if-present ci:set-deploy-flag | |
| deploy-resource: | |
| runs-on: ubuntu-latest | |
| needs: resource-changes | |
| if: needs.resource-changes.outputs.should_deploy == 'true' | |
| timeout-minutes: 10 | |
| environment: | |
| name: resource-ui-dev | |
| url: 'https://resource-dev.lucuma.xyz' | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: ./.github/setup | |
| with: | |
| only-changed: true | |
| FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
| - run: pnpm --filter "resource-ui..." build | |
| - name: Deploy staging app to Firebase | |
| uses: FirebaseExtended/action-hosting-deploy@v0 | |
| with: | |
| repoToken: ${{ secrets.GITHUB_TOKEN }} | |
| firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
| projectId: ${{ vars.FIREBASE_PROJECT_ID }} | |
| entryPoint: ./packages/resource-ui | |
| target: dev | |
| channelId: live |