Files
iot-cloud-api/.gitea/workflows/build_docker.yaml
Tobias Maier 0257434b26
Some checks failed
Build Project / test (push) Failing after 6m9s
Test
2025-02-06 17:27:59 +00:00

59 lines
1.6 KiB
YAML

name: Build Project
on: [push]
jobs:
test:
runs-on: ubuntu-latest
container:
image: rust:latest
services:
db:
image: postgres:latest
env:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
POSTGRES_DB: iot
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Install necessary dependencies
run: apt update && apt install nodejs pkg-config -y
- name: Install docker
run: curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
- name: Checkout Code
uses: actions/checkout@v2
- name: Run migrations
run: cargo install sqlx-cli && sqlx migrate run
- name: Build server binary
run: cargo build --release
- 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
username: tobimai
password: ${{ secrets.docker_registry_key }}
- name: Extract Version from Cargo.toml
id: cargo_version
run: |
VERSION=$(grep '^version' Cargo.toml | head -n 1 | cut -d ' ' -f 3 | tr -d '"')
echo "VERSION=$VERSION" >> $GITEA_ENV
- name: Test
run: echo $VERSION
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: gitea.maiertobi.de/tobimai/iot:$VERSION