fix: replace non-existent dtolnay/rust-action with dtolnay/rust-toolchain #11
Workflow file for this run
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_VERSION: 1.87 | |
| CARGO_BUILD_JOBS: 1 | |
| jobs: | |
| # Build and test Rust server | |
| build-server: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| - name: Cache Cargo dependencies | |
| uses: swatinem/rust-cache@v2 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake clang libssl-dev pkg-config | |
| - name: Build server | |
| working-directory: ./mohawk-server | |
| run: cargo build --release --verbose | |
| - name: Run tests | |
| working-directory: ./mohawk-server | |
| run: cargo test --verbose | |
| - name: Check formatting | |
| working-directory: ./mohawk-server | |
| run: cargo fmt -- --check | |
| - name: Run clippy lints | |
| working-directory: ./mohawk-server | |
| run: cargo clippy -- -D warnings | |
| # Build and test GUI | |
| build-gui: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| working-directory: ./gui | |
| run: npm install | |
| - name: Build GUI | |
| working-directory: ./gui | |
| run: npm run build | |
| - name: Run type check | |
| working-directory: ./gui | |
| run: npx tsc --noEmit | |
| # Build Docker images | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| needs: [build-server, build-gui] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - 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: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push CPU image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./mohawk-server | |
| file: ./mohawk-server/Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/mohawk-server:latest | |
| ghcr.io/${{ github.repository }}/mohawk-server:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push CUDA image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./mohawk-server | |
| file: ./mohawk-server/Dockerfile.cuda | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/mohawk-server-cuda:latest | |
| ghcr.io/${{ github.repository }}/mohawk-server-cuda:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Integration tests | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| needs: build-server | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: ${{ env.RUST_VERSION }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake clang libssl-dev pkg-config | |
| - name: Build server | |
| working-directory: ./mohawk-server | |
| run: cargo build --release | |
| - name: Start server | |
| working-directory: ./mohawk-server | |
| run: | | |
| cargo run --release & | |
| sleep 10 | |
| - name: Run integration tests | |
| working-directory: ./mohawk-server | |
| run: | | |
| python test_server.py || echo "Tests completed" | |
| # Deploy to staging | |
| deploy-staging: | |
| runs-on: ubuntu-latest | |
| needs: [build-docker, integration-tests] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: staging | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to staging | |
| run: | | |
| echo "Deploying to staging environment..." | |
| # Add your deployment commands here (kubectl, docker-compose, etc.) |