58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
name: Build Project
|
|
|
|
on: [push]
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ubuntu:latest
|
|
|
|
# Service containers to run with `container-job`
|
|
services:
|
|
# Label used to access the service container
|
|
db:
|
|
# Docker Hub image
|
|
image: postgres:latest
|
|
# Provide the password for postgres
|
|
env:
|
|
POSTGRES_USER: dev
|
|
POSTGRES_PASSWORD: dev
|
|
POSTGRES_DB: iot
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
ports:
|
|
- 5432:5432
|
|
|
|
steps:
|
|
- run: apt update && apt upgrade -y && apt install docker nodejs curl git build-essential pkg-config openssl libssl-dev -y
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v2
|
|
- name: Run migrations
|
|
run: cargo install sqlx-cli && sqlx migrate run
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Log in to Docker Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: gitea.maiertobi.de # Replace with your Docker registry URL
|
|
username: tobimai
|
|
password: ${{ secrets.docker_registry_key }}
|
|
- name: Build and Push Docker Image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: gitea.maiertobi.de/tobimai/iot # Replace with your Docker image's details
|
|
|
|
|