Update dependency vite to v7 #22735
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: Continuous integration | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| typescript: | |
| name: TypeScript check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read .node-version | |
| id: node-version | |
| run: echo "node-version=$(cat .node-version)" >> $GITHUB_OUTPUT | |
| - name: install node | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| - name: yarn install | |
| run: yarn install | |
| - name: graphql-codegen | |
| run: yarn run graphql:codegen | |
| - name: tsc on resulting generated files | |
| run: yarn run tsc --noEmit | |
| vitest: | |
| name: Vitest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read .node-version | |
| id: node-version | |
| run: echo "node-version=$(cat .node-version)" >> $GITHUB_OUTPUT | |
| - name: install node | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| - name: yarn install | |
| run: yarn install | |
| - name: build | |
| run: COVERAGE=true yarn run test | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() # always run even if the previous step fails | |
| with: | |
| check_name: "Vitest Report" | |
| report_paths: "test/reports/TEST-*.xml" | |
| detailed_summary: true | |
| skip_success_summary: true | |
| - name: Archive HTML test reports | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: vitest-reports | |
| path: test/html_reports/* | |
| - name: Archive coverage report | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: vitest-coverage | |
| path: coverage/* | |
| minitest: | |
| permissions: write-all | |
| name: Minitest | |
| runs-on: ubuntu-latest | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost/intercode_test | |
| RAILS_ENV: test | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install libvips42 | |
| run: sudo apt-get update && sudo apt-get install libvips42 | |
| - name: Upgrade postgres client utilities | |
| run: | | |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
| wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null | |
| sudo apt-get update | |
| sudo apt-get install postgresql-client-18 -y | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Database setup | |
| run: bundle exec rails db:create db:migrate | |
| - name: Run tests | |
| run: TERM=xterm-color bundle exec rails test | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() # always run even if the previous step fails | |
| with: | |
| check_name: "Minitest Report" | |
| report_paths: "test/reports/TEST-*.xml" | |
| detailed_summary: true | |
| skip_success_summary: true | |
| - name: Archive HTML test reports | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: minitest-reports | |
| path: test/html_reports/* | |
| - name: Archive coverage report | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: minitest-coverage | |
| path: coverage/* | |
| minitest-system: | |
| permissions: write-all | |
| name: Minitest system tests | |
| runs-on: ubuntu-latest | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost/intercode_test | |
| RAILS_ENV: test | |
| services: | |
| postgres: | |
| image: postgres:18 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install libvips42 | |
| run: sudo apt-get update && sudo apt-get install libvips42 | |
| - name: Upgrade postgres client utilities | |
| run: | | |
| sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
| wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null | |
| sudo apt-get update | |
| sudo apt-get install postgresql-client-18 -y | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Read .node-version | |
| id: node-version | |
| run: echo "node-version=$(cat .node-version)" >> $GITHUB_OUTPUT | |
| - name: install node | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| - name: yarn install | |
| run: yarn install | |
| - name: build | |
| run: yarn run build | |
| - name: Database setup | |
| run: bundle exec rails db:create db:migrate | |
| - name: Run tests | |
| run: TERM=xterm-color bundle exec rails test:system | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| if: always() # always run even if the previous step fails | |
| with: | |
| check_name: "Minitest System Test Report" | |
| report_paths: "test/reports/TEST-*.xml" | |
| detailed_summary: true | |
| skip_success_summary: true | |
| - name: Archive HTML test reports | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: minitest-system-reports | |
| path: test/html_reports/* | |
| - name: Archive coverage report | |
| uses: actions/upload-artifact@v5 | |
| if: always() | |
| with: | |
| name: minitest-system-coverage | |
| path: coverage/* | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| name: Build containers | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Read .node-version | |
| id: node-version | |
| run: echo "node-version=$(cat .node-version)" >> $GITHUB_OUTPUT | |
| - name: install node | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| - name: yarn install | |
| run: yarn install | |
| - name: Log in to registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build frontend bundle | |
| run: yarn run build | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@master | |
| - name: Read .ruby-version | |
| id: ruby-version | |
| run: echo "ruby-version=$(cat .ruby-version)" >> $GITHUB_OUTPUT | |
| - name: Build (and push to registry, if on main) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | |
| load: ${{ !(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }} | |
| platforms: linux/amd64 | |
| target: production | |
| tags: | | |
| ghcr.io/neinteractiveliterature/intercode:${{ github.sha }} | |
| build-args: | | |
| RUBY_VERSION=${{ steps.ruby-version.outputs.ruby-version }} | |
| NODE_VERSION=${{ steps.node-version.outputs.node-version }} | |
| REVISION=${{ github.sha }} | |
| - name: Check that app can boot | |
| run: > | |
| docker run -e DATABASE_URL=postgresql://fakehost/not_a_real_database | |
| -e AWS_S3_BUCKET=fakebucket | |
| ghcr.io/neinteractiveliterature/intercode:${{ github.sha }} | |
| bin/rails runner 'puts "Hello, world!"' | |
| - name: Build assets only (and push to registry, if on main) | |
| uses: docker/build-push-action@v6 | |
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
| with: | |
| context: . | |
| file: Dockerfile.assets | |
| push: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/neinteractiveliterature/intercode-assets:${{ github.sha }} | |
| build-args: | | |
| BASEIMAGE=ghcr.io/neinteractiveliterature/intercode:${{ github.sha }} | |
| doc-site: | |
| name: Build doc site | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up docusaurus cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: doc-site/.yarn/.cache/webpack | |
| key: ${{ runner.os }}-doc-site-docusaurus-${{ github.ref }} | |
| restore-keys: | | |
| ${{ runner.os }}-doc-site-docusaurus-${{ github.ref }} | |
| ${{ runner.os }}-doc-site-docusaurus- | |
| - name: Install libvips42 | |
| run: sudo apt-get update && sudo apt-get install libvips42 | |
| - name: Read .node-version | |
| id: node-version | |
| run: echo "node-version=$(cat .node-version)" >> $GITHUB_OUTPUT | |
| - name: install node | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| - name: Install dependencies for generating Liquid doc JSON | |
| run: gem install yard toys pry --no-doc | |
| - name: yarn install | |
| run: yarn install | |
| - name: Generate GraphQL schema | |
| run: bin/rails graphql:schema:dump | |
| - name: Generate Liquid doc JSON | |
| run: toys update_liquid_doc_json | |
| - name: Build doc site | |
| run: cd doc-site && yarn run docusaurus graphql-to-doc -f && yarn node liquid-to-doc.js && yarn run build | |
| env: | |
| # docusaurus breaks on Node 17+ if we don't do this | |
| NODE_OPTIONS: --openssl-legacy-provider | |
| - name: Compress built site | |
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
| run: tar cfz doc-site.tar.gz ./doc-site/build | |
| - name: Store built site | |
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: doc-site | |
| path: doc-site.tar.gz | |
| coverage-report: | |
| runs-on: ubuntu-latest | |
| name: Test coverage report | |
| if: github.actor != 'dependabot[bot]' | |
| needs: | |
| - vitest | |
| - minitest | |
| - minitest-system | |
| steps: | |
| - name: Download Minitest coverage | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: minitest-coverage | |
| path: minitest-coverage | |
| - name: Download Minitest system test coverage | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: minitest-system-coverage | |
| path: minitest-system-coverage | |
| - name: Download Vitest coverage | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: vitest-coverage | |
| path: vitest-coverage | |
| - name: Merge coverage reports | |
| run: npx cobertura-merge -o merged-coverage.xml package1=minitest-coverage/coverage.xml package2=vitest-coverage/cobertura-coverage.xml package3=minitest-system-coverage/coverage.xml | |
| - name: Generate Coverage Report | |
| uses: clearlyip/code-coverage-report-action@v6 | |
| id: code_coverage_report_action | |
| with: | |
| filename: "merged-coverage.xml" | |
| fail_on_negative_difference: true | |
| artifact_download_workflow_names: "ci,cron" | |
| only_list_changed_files: true | |
| - name: Add Coverage PR Comment | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| update-release-draft: | |
| runs-on: ubuntu-latest | |
| name: Update release draft | |
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
| needs: | |
| - typescript | |
| - vitest | |
| - minitest | |
| - minitest-system | |
| - docker-build | |
| - doc-site | |
| outputs: | |
| name: ${{ steps.release-drafter.outputs.name }} | |
| html_url: ${{ steps.release-drafter.outputs.html_url }} | |
| steps: | |
| - uses: release-drafter/release-drafter@v6 | |
| id: release-drafter | |
| with: | |
| config-name: release-drafter.yml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Format Slack post | |
| id: slack-post | |
| run: | | |
| echo "text<<END_OF_SLACK_MESSAGE" >> "$GITHUB_OUTPUT" | |
| echo -e "Draft release ${{ steps.release-drafter.outputs.name }} updated:\n" >> "$GITHUB_OUTPUT" | |
| echo -e "- ${{ join(github.event.commits.*.message, '\n- ') }}\n" >> "$GITHUB_OUTPUT" | |
| echo "To release Intercode to production, visit: ${{ steps.release-drafter.outputs.html_url }}" >> "$GITHUB_OUTPUT" | |
| echo END_OF_SLACK_MESSAGE >> "$GITHUB_OUTPUT" | |
| - name: Post about drafted release to Slack | |
| id: slack | |
| uses: slackapi/slack-github-action@v2.1.1 | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACKTOKEN }} | |
| payload: | | |
| channel: ${{ secrets.SlackCISuccessNotificationChannelID }} | |
| text: ${{ toJson(steps.slack-post.outputs.text) }} |