This commit is contained in:
@ -1,19 +1,26 @@
|
|||||||
name: Gitea Actions Demo
|
name: Backend Actions
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
run-name: ${{ gitea.actor }} is running backend actions
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Explore-Gitea-Actions:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: rust-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
- uses: actions/checkout@v4
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
- name: Load Cache
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
uses: actions/cache@v4
|
||||||
- name: Check out repository code
|
with:
|
||||||
uses: actions/checkout@v4
|
path: |
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
~/.cargo/registry
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
~/.cargo/git
|
||||||
- name: List files in the repository
|
target
|
||||||
run: |
|
key: ${{ runner.os }}-cargo--${{ hashFiles('Cargo.lock') }}
|
||||||
ls ${{ gitea.workspace }}
|
- name: Build Binary
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
run: cargo build --release
|
||||||
|
- name: Run Tests
|
||||||
|
run: ./scripts/test.sh
|
||||||
|
- name: Upload Test Logs
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: nuchat-${{ hashFiles('src/**') }}-${{ hashFiles('tests/**') }}.log
|
||||||
|
path: logs/*
|
||||||
|
|||||||
@ -8,9 +8,7 @@ start:
|
|||||||
cargo run --features shutdown 2>&1 > logs/nuchat.log
|
cargo run --features shutdown 2>&1 > logs/nuchat.log
|
||||||
|
|
||||||
test:
|
test:
|
||||||
cargo run --features shutdown -- --port 7001 2>&1 > logs/nuchat.log &
|
./scripts/test.sh
|
||||||
cargo test
|
|
||||||
curl -s -X POST localhost:7001/admin/shutdown
|
|
||||||
|
|
||||||
default := 'run'
|
default := 'run'
|
||||||
watch CMD=default:
|
watch CMD=default:
|
||||||
|
|||||||
9
backend/scripts/test.sh
Normal file
9
backend/scripts/test.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# ensure server is not started
|
||||||
|
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
|
||||||
|
|
||||||
|
# start server
|
||||||
|
cargo run --features shutdown -- --port 7001 2>&1 > logs/nuchat.log &
|
||||||
|
|
||||||
|
# run tests
|
||||||
|
cargo test | tee logs/test-output.log
|
||||||
Reference in New Issue
Block a user