This commit is contained in:
Xiretza 2025-02-11 23:41:25 +00:00
parent dabd642d03
commit 781fdb62ee

View file

@ -0,0 +1,82 @@
name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check formatting and lints
runs-on: docker
container:
image: "archlinux:base-devel"
strategy:
matrix:
toolchain:
- stable
#- beta
#- nightly
steps:
- name: Install dependencies
run: |
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm nodejs git rustup sqlite
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup update nightly ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: https://github.com/Swatinem/rust-cache@v2
- name: Check formatting
run: cargo +nightly fmt --check
- name: Check clippy lints
run: cargo clippy -- -D warnings
build_and_test:
name: Build and test
runs-on: docker
container:
image: "archlinux:base-devel"
strategy:
matrix:
toolchain:
- stable
#- beta
#- nightly
steps:
- name: Install dependencies
run: |
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm nodejs git rustup sqlite
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: https://github.com/Swatinem/rust-cache@v2
- name: Build application
run: cargo build --release
#- name: Run tests
# run: cargo test
- uses: actions/upload-artifact@v3
with:
path: target/release/its-matrix-bot
deploy:
#if: github.ref == 'refs/heads/main'
name: Deploy to vandal
needs: [check, build_and_test]
runs-on: docker
container:
image: "archlinux:base-devel"
steps:
- name: Install dependencies
run: |
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm nodejs git rsync
- uses: actions/download-artifact@v3
- run: ls -R
- name: Deploy to vandal
run: |
mkdir -p ~/.ssh
chmod -R 700 ~/.ssh
echo "${{ secrets.SSH_KEY_VANDAL }}" > ~/.ssh/id_ed25519
echo "vandal.srv.it-syndikat.org ssh-ed25520 AAAAC3NzaC1lZDI1NTE5AAAAIKwSkHeKN+dRkw2Lx0KZTdXZOjAjkrM14XzujXxK3oGw" >> ~/.ssh/known_hosts
rsync -vva its-matrix-bot deployer@vandal.srv.it-syndikat.org:/