Update weekly patch updates #3988
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 | |
| on: | |
| pull_request: | |
| branches: [main, "renovate/*", "CHAOS-224-KHAOS-rewrite", "CHAOS-571-integrate-be-fe", "CHAOS-598-nextjs"] | |
| paths: | |
| - "backend/**" | |
| - ".github/workflows/rust.yml" | |
| push: | |
| branches: ["renovate/*"] | |
| paths: | |
| - "backend/**" | |
| - ".github/workflows/rust.yml" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_DB: chaos | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup env file | |
| run: | | |
| echo "DATABASE_URL=postgres://postgres:password@localhost:5432/chaos" >> backend/.env | |
| echo "JWT_SECRET=test_secret" >> backend/.env | |
| echo "GOOGLE_CLIENT_ID=test" >> backend/.env | |
| echo "GOOGLE_CLIENT_SECRET=test" >> backend/.env | |
| echo "GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback" >> backend/.env | |
| echo "S3_BUCKET_NAME=chaos-storage" >> backend/.env | |
| echo "S3_ACCESS_KEY=test_access_key" >> backend/.env | |
| echo "S3_SECRET_KEY=test_secret_key" >> backend/.env | |
| echo "S3_ENDPOINT=https://chaos-storage.s3.ap-southeast-1.amazonaws.com" >> backend/.env | |
| echo "S3_REGION_NAME=ap-southeast-1" >> backend/.env | |
| echo "DEV_ENV=dev" >> backend/.env | |
| echo "EMAIL_FROM=noreply@example.com" >> backend/.env | |
| echo "SMTP_USERNAME=test_username" >> backend/.env | |
| echo "SMTP_PASSWORD=test_password" >> backend/.env | |
| echo "SMTP_HOST=smtp.example.com" >> backend/.env | |
| echo "SMTP_PORT=587" >> backend/.env | |
| echo "CAMPAIGN_NAME_MAX_CHARS=50" >> backend/.env | |
| echo "CAMPAIGN_DESCRIPTION_MAX_ChARS=500" >> backend/.env | |
| echo "ROLE_NAME_MAX_CHARS=20" >> backend/.env | |
| echo "ROLE_DESCRIPTION_MAX_CHARS=50" >> backend/.env | |
| echo "ROLE_POSITIONS_AVAILABLE_MAX=20" >> backend/.env | |
| echo "CHAOS_SUPER_USER_EMAIL=me@example.com" >> backend/.env | |
| # selecting a toolchain either by action or manual `rustup` calls should happen | |
| # before the plugin, as it uses the current rustc version as its cache key | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - name: Setup cargo cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| backend/server/target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: ${{ runner.os }}-cargo- | |
| - name: Migrate DB | |
| working-directory: backend | |
| run: | | |
| which sqlx || cargo install sqlx-cli --no-default-features --features native-tls,postgres | |
| sqlx database create | |
| sqlx migrate run | |
| - name: Build | |
| working-directory: backend/server | |
| run: cargo build | |
| - name: Database Seeding | |
| working-directory: backend/database-seeding | |
| run: | | |
| cargo build | |
| cargo run -- --email me@example.com |