Updated groupbanner for FlashIT #340
This file contains 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
on: [push, pull_request] | |
name: "Backend CI" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
env: | |
SQLX_OFFLINE: true | |
with: | |
command: check | |
args: --manifest-path=backend/Cargo.toml | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
env: | |
SQLX_OFFLINE: true | |
with: | |
command: test | |
args: --manifest-path=backend/Cargo.toml | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add clippy | |
- uses: actions-rs/cargo@v1 | |
env: | |
SQLX_OFFLINE: true | |
with: | |
command: clippy | |
args: --manifest-path=backend/Cargo.toml -- -D warnings | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --manifest-path=backend/Cargo.toml --all -- --check | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
needs: | |
- build | |
- test | |
- lint | |
- format | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ghcr.io/cthit/hubbit-backend:latest |