-
Notifications
You must be signed in to change notification settings - Fork 173
[anneal] Add playground tests and automation #3542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Gbja7ynjo5n4gf6rek56jhkaclymvo22y
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| name: Crate addition or update | ||
| about: Suggest a new or updated crate for the playground | ||
| title: Please add/update [cratename] | ||
| labels: wontfix | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| Please read [our crate policy][policy]. Any issue opened for a new or updated crate version will be closed with a reference to the same policy. | ||
|
|
||
| [policy]: https://github.com/rust-lang/rust-playground/blob/master/CRATE_POLICY.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: "Build and push image" | ||
| description: "Build and push image" | ||
|
|
||
| inputs: | ||
| channel: | ||
| description: "The Rust channel to build" | ||
| required: true | ||
|
|
||
| tags: | ||
| description: "The newline-separated tags to create" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - uses: docker/build-push-action@v6 | ||
| with: | ||
| context: compiler/base/ | ||
| file: compiler/base/Dockerfile | ||
| build-args: |- | ||
| channel=${{ inputs.channel }} | ||
| push: true | ||
| tags: ${{ inputs.tags }} | ||
| cache-from: type=gha,scope=${{ inputs.channel }} | ||
| cache-to: type=gha,scope=${{ inputs.channel }},mode=max |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,265 @@ | ||
| # This file was generated by ci/generate and should not be modified by hand | ||
| --- | ||
| name: Validate everything | ||
| 'on': | ||
| push: | ||
| pull_request: | ||
| types: | ||
| - labeled | ||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With Useful? React with πΒ / π. |
||
| branches: | ||
| - main | ||
| env: | ||
| DOCKER_HUB_USERNAME: shepmaster | ||
| GH_CONTAINER_REGISTRY_USERNAME: shepmaster | ||
| AWS_ACCESS_KEY_ID: AKIAWESVHZ3JQAY5NM5K | ||
| jobs: | ||
| build_compiler_images: | ||
| name: Build provisional ${{ matrix.channel }} image | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| channel: | ||
| - stable | ||
| - beta | ||
| - nightly | ||
| if: 'github.event_name == ''push'' || contains(github.event.pull_request.labels.*.name, ''CI: approved'')' | ||
| env: | ||
| GHCR_IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-rust-${{ matrix.channel }} | ||
| DOCKER_HUB_IMAGE_NAME: shepmaster/rust-${{ matrix.channel }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: "${{ env.GH_CONTAINER_REGISTRY_USERNAME }}" | ||
| password: "${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}" | ||
|
Comment on lines
+34
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This login is in a job that also runs for labeled Useful? React with πΒ / π. |
||
| - name: Build provisional ${{ matrix.channel }} image | ||
| uses: "./.github/actions/build-and-push-image" | ||
| with: | ||
| channel: "${{ matrix.channel }}" | ||
| tags: "${{ env.GHCR_IMAGE_NAME }}:${{ github.run_id }}" | ||
| build_backend: | ||
| name: Build backend | ||
| runs-on: ubuntu-latest | ||
| if: 'github.event_name == ''push'' || contains(github.event.pull_request.labels.*.name, ''CI: approved'')' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt | ||
| - name: Format server | ||
| run: cargo fmt --manifest-path ui/Cargo.toml --all --check | ||
| - name: Format top-crates | ||
| run: cargo fmt --manifest-path top-crates/Cargo.toml --check | ||
| - name: Format orchestrator | ||
| run: cargo fmt --manifest-path compiler/base/orchestrator/Cargo.toml --check | ||
| - name: Build backend | ||
| run: "./ci/build-backend.sh" | ||
| - name: Save backend artifact | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: backend | ||
| path: | | ||
| docker-output/ui | ||
| docker-output/unit_tests_ui | ||
| docker-output/unit_tests_orchestrator | ||
| build_frontend: | ||
| name: Build frontend | ||
| runs-on: ubuntu-latest | ||
| if: 'github.event_name == ''push'' || contains(github.event.pull_request.labels.*.name, ''CI: approved'')' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Configure node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 24.12 | ||
| - name: Get pnpm version from package.json | ||
| id: pnpm-version | ||
| run: 'echo "pnpm_version=$(node -p ''require(`./ui/frontend/package.json`).engines.pnpm'')" >> $GITHUB_OUTPUT | ||
|
|
||
| ' | ||
| - name: Install pnpm | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: "${{ steps.pnpm-version.outputs.pnpm_version }}" | ||
| - name: Get pnpm store directory | ||
| id: pnpm-cache-dir-path | ||
| run: 'echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | ||
|
|
||
| ' | ||
| - name: Cache pnpm intermediate products | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: "${{ steps.pnpm-cache-dir-path.outputs.dir }}" | ||
| key: "${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}" | ||
| restore-keys: "${{ runner.os }}-pnpm-\n" | ||
| - name: Install dependencies | ||
| run: pnpm --dir ui/frontend/ install | ||
| - name: Run tests | ||
| run: pnpm --dir ui/frontend/ run test | ||
| - name: Lint | ||
| run: pnpm --dir ui/frontend/ run test:lint | ||
| - name: Style | ||
| run: pnpm --dir ui/frontend/ run test:style | ||
| - name: Build frontend | ||
| run: pnpm --dir ui/frontend/ run build:production | ||
| - name: Save frontend artifact | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: frontend | ||
| path: ui/frontend/build | ||
| run_integration_tests: | ||
| name: Running integration tests | ||
| runs-on: ubuntu-latest | ||
| if: 'github.event_name == ''push'' || contains(github.event.pull_request.labels.*.name, ''CI: approved'')' | ||
| needs: | ||
| - build_compiler_images | ||
| - build_backend | ||
| - build_frontend | ||
| defaults: | ||
| run: | ||
| working-directory: tests | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Recover disk space | ||
| run: sudo rm -rf /usr/local/lib/android | ||
| - name: Configure Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: 3.3.6 | ||
| - name: Cache bundler intermediate products | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: tests/vendor/bundle | ||
| key: "${{ runner.os }}-gems-${{ hashFiles('tests/**/Gemfile.lock') }}" | ||
| restore-keys: "${{ runner.os }}-gems-" | ||
| - name: Install gems | ||
| run: |- | ||
| gem install bundler | ||
| bundle config path vendor/bundle | ||
| bundle install --jobs 4 --retry 3 | ||
| - name: Pull images | ||
| run: echo ghcr.io/integer32llc/rust-playground-ci-rust-{stable,beta,nightly}:${{ github.run_id }} | xargs -n1 docker pull --platform linux/amd64 | ||
| - name: Rename images | ||
| run: |- | ||
| for c in stable beta nightly; do | ||
| docker tag ghcr.io/integer32llc/rust-playground-ci-rust-$c:${{ github.run_id }} rust-$c | ||
| done | ||
| - name: Download backend | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: backend | ||
| path: tests/server/ | ||
| - name: Download frontend | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: frontend | ||
| path: tests/server/build/ | ||
| - name: Run orchestrator unit tests | ||
| env: | ||
| TESTS_MAX_CONCURRENCY: 3 | ||
| TESTS_TIMEOUT_MS: 30000 | ||
| run: chmod +x ./server/unit_tests_orchestrator && ./server/unit_tests_orchestrator | ||
| - name: Run ui unit tests | ||
| run: chmod +x ./server/unit_tests_ui && ./server/unit_tests_ui | ||
| - name: Run tests | ||
| env: | ||
| PLAYGROUND_UI_ROOT: server/build/ | ||
| PLAYGROUND_CORS_ENABLED: true | ||
| PLAYGROUND_GITHUB_TOKEN: "${{ secrets.PLAYGROUND_GITHUB_TOKEN }}" | ||
| run: |- | ||
| killall -q ui || true | ||
| chmod +x ./server/ui && ./server/ui & | ||
| bundle exec rspec | ||
|
Comment on lines
+177
to
+181
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This always runs the full RSpec suite even when Useful? React with πΒ / π. |
||
| - name: Preserve screenshots | ||
| if: "${{ failure() }}" | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: test-failures | ||
| path: tests/test-failures | ||
| release_artifacts: | ||
| name: Release artifacts | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - run_integration_tests | ||
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Download backend | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: backend | ||
| path: server/ | ||
| - name: Download frontend | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: frontend | ||
| path: server/build/ | ||
| - name: Configure AWS credentials (i32) | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| aws-access-key-id: "${{ env.AWS_ACCESS_KEY_ID }}" | ||
| aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | ||
| aws-region: us-east-2 | ||
| - name: Push backend (i32) | ||
| run: aws s3 cp server/ui s3://playground-artifacts-i32 | ||
| - name: Push frontend (i32) | ||
| run: aws s3 sync server/build/ s3://playground-artifacts-i32/build | ||
| - name: Configure AWS credentials (rust-lang) | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| role-skip-session-tagging: true | ||
| role-to-assume: arn:aws:iam::890664054962:role/upload-playground-artifacts | ||
| aws-region: us-west-1 | ||
| - name: Push backend (rust-lang) | ||
| run: aws s3 cp server/ui s3://rust-playground-artifacts | ||
| - name: Push frontend (rust-lang) | ||
| run: aws s3 sync server/build/ s3://rust-playground-artifacts/build | ||
| release_docker_artifacts: | ||
| name: Release ${{ matrix.channel }} image | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| channel: | ||
| - stable | ||
| - beta | ||
| - nightly | ||
| needs: | ||
| - run_integration_tests | ||
| env: | ||
| GHCR_IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-rust-${{ matrix.channel }} | ||
| DOCKER_HUB_IMAGE_NAME: shepmaster/rust-${{ matrix.channel }} | ||
| if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: "${{ env.GH_CONTAINER_REGISTRY_USERNAME }}" | ||
| password: "${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}" | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: "${{ env.DOCKER_HUB_USERNAME }}" | ||
| password: "${{ secrets.DOCKER_HUB_TOKEN }}" | ||
| - name: Release ${{ matrix.channel }} image | ||
| uses: "./.github/actions/build-and-push-image" | ||
| with: | ||
| channel: "${{ matrix.channel }}" | ||
| tags: |- | ||
| ${{ env.GHCR_IMAGE_NAME }} | ||
| ${{ env.DOCKER_HUB_IMAGE_NAME }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # This file was generated by ci/generate and should not be modified by hand | ||
| --- | ||
| name: Scheduled rebuild | ||
| 'on': | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: 7 2 * * * | ||
| env: | ||
| DOCKER_HUB_USERNAME: shepmaster | ||
| GH_CONTAINER_REGISTRY_USERNAME: shepmaster | ||
| AWS_ACCESS_KEY_ID: AKIAWESVHZ3JQAY5NM5K | ||
| jobs: | ||
| build_compiler_images: | ||
| name: Release ${{ matrix.channel }} image | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| channel: | ||
| - stable | ||
| - beta | ||
| - nightly | ||
| env: | ||
| GHCR_IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-rust-${{ matrix.channel }} | ||
| DOCKER_HUB_IMAGE_NAME: shepmaster/rust-${{ matrix.channel }} | ||
| continue-on-error: true | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: "${{ env.GH_CONTAINER_REGISTRY_USERNAME }}" | ||
| password: "${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}" | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: "${{ env.DOCKER_HUB_USERNAME }}" | ||
| password: "${{ secrets.DOCKER_HUB_TOKEN }}" | ||
| - name: Release ${{ matrix.channel }} image | ||
| uses: "./.github/actions/build-and-push-image" | ||
| with: | ||
| channel: "${{ matrix.channel }}" | ||
| tags: |- | ||
| ${{ env.GHCR_IMAGE_NAME }} | ||
| ${{ env.DOCKER_HUB_IMAGE_NAME }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| FROM rust:alpine | ||
|
|
||
| RUN apk add musl-dev openssl-dev openssl-libs-static | ||
|
|
||
| # Adding -C relocation-model=static due to | ||
| # https://github.com/rust-lang/rust/issues/95926 | ||
|
|
||
| # Adding this to find the statically-built version | ||
| ENV OPENSSL_NO_PKG_CONFIG=1 OPENSSL_STATIC=1 OPENSSL_DIR=/usr/ | ||
|
|
||
| RUN mkdir /output | ||
|
|
||
| COPY compiler/base/asm-cleanup /compiler/base/asm-cleanup | ||
| COPY compiler/base/orchestrator /compiler/base/orchestrator | ||
| COPY compiler/base/modify-cargo-toml /compiler/base/modify-cargo-toml | ||
| COPY ui /ui | ||
|
|
||
| WORKDIR /compiler/base/orchestrator | ||
|
|
||
| RUN \ | ||
| cargo rustc --profile test --lib --locked -- --cfg force_docker -C relocation-model=static; \ | ||
| test_bin=$(find target/debug/deps/ -name "orchestrator*" -type f -perm -a=x); \ | ||
| mv "${test_bin}" /output/unit_tests_orchestrator; | ||
|
|
||
| WORKDIR /ui | ||
|
|
||
| RUN \ | ||
| cargo rustc --tests --locked -- -C relocation-model=static; \ | ||
| test_bin=$(find target/debug/deps/ -name "ui*" -type f -perm -a=x); \ | ||
| mv "${test_bin}" /output/unit_tests_ui; | ||
|
|
||
| # Bake in debug information to debug deadlocks in production | ||
| RUN mkdir .cargo | ||
| RUN cat <<EOF >.cargo/config.toml | ||
| [profile.release] | ||
| debug = "full" | ||
| split-debuginfo = "off" | ||
| EOF | ||
|
|
||
| RUN \ | ||
| cargo rustc --locked --release -- -C relocation-model=static; \ | ||
| mv target/release/ui /output/ui; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow is committed under
anneal/v1/playground/rust-anneal-playground/.github/workflows, but this repository's active workflows live under the repository-root.github/workflowsdirectory; GitHub Actions only discovers workflow files from that root location (see GitHub's workflow docs). As committed, none of the new backend/frontend/integration/release automation will trigger for pushes or PRs in this repo, so the added tests and deploy jobs are inert unless a root workflow delegates into this playground directory.Useful? React with πΒ / π.