feat(player-performance): Update player performance curve to use game… #658
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: Rust CI/CD | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Docker image tag to push (e.g., v1.0.0, specific-feature)' | |
| required: true | |
| type: string | |
| env: | |
| CARGO_TERM_COLOR: always | |
| IMAGE_NAME: ghcr.io/${{ github.repository }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| cancel-in-progress: true | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| fmt: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Update Rust toolchain to stable | |
| run: | | |
| rustup override set stable | |
| rustup update stable | |
| rustup component add rustfmt | |
| - name: Rustfmt Check | |
| uses: actions-rust-lang/rustfmt@v1 | |
| deps: | |
| name: Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Update Rust toolchain to stable | |
| run: | | |
| rustup override set stable | |
| rustup update stable | |
| - name: Machete | |
| uses: bnjbvr/cargo-machete@7959c845782fed02ee69303126d4a12d64f1db18 | |
| typos: | |
| name: Typos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Update Rust toolchain to stable | |
| run: | | |
| rustup override set stable | |
| rustup update stable | |
| - uses: taiki-e/cache-cargo-install-action@v3 | |
| with: | |
| tool: typos-cli | |
| - name: Typos Check | |
| run: typos src/ | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Protocol Buffers compiler | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libprotobuf-dev clang mold | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "build-cache-${{ runner.os }}-${{ runner.arch }}-stable" | |
| - name: Update Rust toolchain to stable | |
| run: | | |
| rustup override set stable | |
| rustup update stable | |
| rustup component add clippy | |
| - name: Cargo Clippy (Deny Warnings) | |
| run: cargo clippy --all-targets --locked -- -D warnings | |
| - name: Cargo Clippy (Allow Warnings) | |
| run: cargo clippy --all-targets --locked | |
| test_deploy: | |
| name: Test and Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Determine Docker Tag | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| DOCKER_TAG="${{ inputs.tag }}" | |
| elif [[ "${{ github.ref }}" == "refs/heads/master" ]]; then | |
| DOCKER_TAG="latest" | |
| else | |
| DOCKER_TAG="${{ github.sha }}" | |
| fi | |
| echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV | |
| echo "Using Docker tag: $DOCKER_TAG" | |
| ############################### | |
| ## Setup ## | |
| ############################### | |
| - uses: actions/checkout@v6 | |
| - name: Setup go-task | |
| run: if [ ! -f "~/.local/bin/task" ]; then curl -sSf https://taskfile.dev/install.sh | sh -s -- -b ~/.local/bin; fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Start API Dependency Docker Images (in Background) | |
| run: nohup task start-test-env-api-deps > pull.log 2>&1 & | |
| - name: Install Protocol Buffers compiler | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libprotobuf-dev clang mold | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "build-cache-${{ runner.os }}-${{ runner.arch }}-stable" | |
| - name: Update Rust toolchain to stable | |
| run: | | |
| rustup override set stable | |
| rustup update stable | |
| - uses: taiki-e/cache-cargo-install-action@v3 | |
| with: | |
| tool: cargo-nextest | |
| ############################### | |
| ## Test Code ## | |
| ############################### | |
| - name: Unit Tests | |
| run: cargo nextest run --locked --lib --status-level fail | |
| ############################### | |
| ## Build ## | |
| ############################### | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| tags: ${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }} | |
| load: true | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| ############################### | |
| ## Test Code ## | |
| ############################### | |
| - name: Test Docker image | |
| run: NO_BUILD=1 IMAGE=${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }} task test | |
| ############################### | |
| ## Deploy Code ## | |
| ############################### | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push Docker image | |
| if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' | |
| run: docker push ${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }} |