writing login template in login_form #158
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
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: --privileged | |
ports: | |
- 2375:2375 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker | |
run: | | |
sudo service docker start | |
echo "Docker daemon started" | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
- name: Start services with Docker Compose | |
run: | | |
docker-compose up -d | |
sleep 10 | |
- name: Run migrations | |
run: | | |
cargo install sqlx-cli | |
sqlx migrate run --database-url ${{ secrets.DATABASE_URL }} | |
- name: Check and Lint | |
run: | | |
cargo check | |
cargo clippy -- -D warnings | |
- name: Check sqlx query cache | |
run: cargo sqlx prepare --check | |
- name: Build | |
run: cargo build --verbose | |
- name: test .env | |
run: echo "${{ secrets.TEST_ENV_FILE }}" > .env | |
- name: Run tests | |
run: DATABASE_URL=${{ secrets.DATABASE_URL }} cargo test --verbose | |
- name: prod .env | |
run: echo "${{ secrets.ENV_FILE }}" > .env | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ secrets.DOCKER_TAGS }} | |
- name: Restart Docker Compose on Remote Server | |
if: github.event_name != 'pull_request' | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} # Add your server's IP address or hostname to your repository's secrets | |
username: ${{ secrets.REMOTE_USER }} # Add your server's SSH username to your repository's secrets | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd ${{ secrets.REMOTE_PATH }} | |
docker compose -f docker-compose.yml -f docker-compose.production.yml pull | |
docker compose -f docker-compose.yml -f docker-compose.production.yml down | |
docker compose -f docker-compose.yml -f docker-compose.production.yml up -d |