Partial switch to Gitea Actions
All checks were successful
Build and deploy automation_rs / Build (push) Successful in 4m59s

This commit is contained in:
Dreaded_X 2023-11-16 01:45:45 +01:00
parent 73a2b077ed
commit 8b3481878b
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
3 changed files with 60 additions and 49 deletions

View File

@ -1,49 +0,0 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: docker
volumes:
- name: socket
path: /var/run/docker.sock
commands:
- DOCKER_BUILDKIT=1 docker build -t automation_rs .
- name: deploy
image: docker
volumes:
- name: socket
path: /var/run/docker.sock
environment:
MQTT_PASSWORD:
from_secret: MQTT_PASSWORD
HUE_TOKEN:
from_secret: HUE_TOKEN
NTFY_TOPIC:
from_secret: NTFY_TOPIC
RUST_LOG:
from_secret: RUST_LOG
commands:
- docker stop automation_rs || true
- docker rm automation_rs || true
# Networks need to be setup to to allow broadcasts: https://www.devwithimagination.com/2020/06/15/homebridge-docker-and-wake-on-lan/ https://github.com/dhutchison/container-images/blob/0c2d7d96bab751fb0a008cc91ba2990724bbd11f/homebridge/configure_docker_networks_for_wol.sh
# Needs to be done for ALL networks, because we can't seem to control which interface gets used to send the broadcast
- docker create -e RUST_LOG=$RUST_LOG -e MQTT_PASSWORD=$MQTT_PASSWORD -e HUE_TOKEN=$HUE_TOKEN -e NTFY_TOPIC=$NTFY_TOPIC --network mqtt --restart unless-stopped --name automation_rs automation_rs
- docker network connect web automation_rs
- docker start automation_rs
when:
branch:
- master
event:
exclude:
- pull_request
volumes:
- name: socket
host:
path: /var/run/docker.sock

View File

@ -0,0 +1,56 @@
# Based on: https://pastebin.com/99Fq2b2w
name: Build and deploy automation_rs
on:
push:
branches:
- main
- feature/actions
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Formatting
uses: actions-rust-lang/rustfmt@v1
- name: Clippy
run: cargo clippy --all-targets --all -- -D warnings
- name: Build
run: cargo build --release
# create-docker-container:
# name: docker build
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - uses: actions/checkout@v4
# - uses: Swatinem/rust-cache@v2
# with:
# shared-key: "automation_rs"
# - run: ls -alh
# create-docker-container:
# runs-on: ubuntu-latest
# container: catthehacker/ubuntu:act-latest
# steps:
# - name: Checkout repository
# uses: https://github.com/actions/checkout@v3
#
# - name: Set up Docker BuildX
# uses: https://github.com/docker/setup-buildx-action@v3
#
# - name: Login to registry
# uses: https://github.com/docker/login-action@v3
# with:
# registry: git.huizinga.dev
# username: ${{ gitea.actor }}
# password: ${{ secrets.REGISTRY_TOKEN }}
#
# - name: Build and push Docker image
# uses: https://github.com/docker/build-push-action@v5
# with:
# context: .
# push: true
# tags: git.huizinga.dev/dreaded_x/automation_rs:latest

4
rust-toolchain.toml Normal file
View File

@ -0,0 +1,4 @@
[toolchain]
channel = "nightly-2023-11-15"
components = ["rustfmt", "clippy"]
profile = "minimal"