- Added wiki-sync job to .gitea/workflows/test.yml - Runs only on pushes to master branch - Automatically copies docs/wiki/*.md to Gogs wiki repository - Supports token-based authentication via secrets.GITHUB_TOKEN - Handles wiki initialization if repository doesn't exist - Bumped version to 0.2.7 Wiki sync will now automatically update the Gogs wiki at https://gogs.tftsr.com/sarman/tftsr-devops_investigation/wiki whenever docs/wiki/ files are modified on master.
176 lines
6.0 KiB
YAML
176 lines
6.0 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
|
|
jobs:
|
|
rust-fmt-check:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- run: rustup component add rustfmt
|
|
- run: cargo fmt --manifest-path src-tauri/Cargo.toml --check
|
|
|
|
rust-clippy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
|
- run: rustup component add clippy
|
|
- run: cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
|
|
|
|
rust-tests:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: rust:1.88-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- run: apt-get update -qq && apt-get install -y -qq libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf pkg-config perl
|
|
- run: cargo test --manifest-path src-tauri/Cargo.toml
|
|
|
|
frontend-typecheck:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:22-alpine
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apk add --no-cache git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npx tsc --noEmit
|
|
|
|
frontend-tests:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: node:22-alpine
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apk add --no-cache git
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
- run: npm ci --legacy-peer-deps
|
|
- run: npm run test:run
|
|
|
|
wiki-sync:
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/master'
|
|
container:
|
|
image: alpine:latest
|
|
steps:
|
|
- name: Install dependencies
|
|
run: apk add --no-cache git openssh-client
|
|
|
|
- name: Checkout main repository
|
|
run: |
|
|
git init
|
|
git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
|
|
git fetch --depth=1 origin $GITHUB_SHA
|
|
git checkout FETCH_HEAD
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config --global user.email "actions@gitea.local"
|
|
git config --global user.name "Gitea Actions"
|
|
|
|
- name: Clone wiki repository
|
|
run: |
|
|
cd /tmp
|
|
# Use token authentication if available, fallback to unauthenticated
|
|
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
|
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
else
|
|
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
fi
|
|
git clone "$WIKI_URL" wiki || true
|
|
|
|
- name: Initialize wiki if clone failed
|
|
run: |
|
|
if [ ! -d /tmp/wiki ]; then
|
|
echo "Wiki repository doesn't exist yet or clone failed, initializing..."
|
|
mkdir -p /tmp/wiki
|
|
cd /tmp/wiki
|
|
git init
|
|
git checkout -b master
|
|
echo "# Wiki" > Home.md
|
|
git add Home.md
|
|
git commit -m "Initial wiki commit"
|
|
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
|
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
else
|
|
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
fi
|
|
git remote add origin "$WIKI_URL"
|
|
fi
|
|
|
|
- name: Sync wiki files
|
|
run: |
|
|
# Copy all markdown files from docs/wiki/ to wiki repo root
|
|
if [ -d "docs/wiki" ] && [ "$(ls -A docs/wiki/*.md 2>/dev/null)" ]; then
|
|
cp -v docs/wiki/*.md /tmp/wiki/
|
|
echo "Copied $(ls docs/wiki/*.md | wc -l) wiki files"
|
|
else
|
|
echo "No wiki markdown files found in docs/wiki/"
|
|
fi
|
|
|
|
- name: Commit and push wiki changes
|
|
run: |
|
|
cd /tmp/wiki
|
|
git add -A
|
|
|
|
# Check if there are any changes
|
|
if git diff --staged --quiet; then
|
|
echo "No wiki changes to commit"
|
|
exit 0
|
|
fi
|
|
|
|
# Commit changes
|
|
git commit -m "docs: sync from docs/wiki/ at commit ${GITHUB_SHA:0:8}"
|
|
|
|
# Prepare push URL with token if available
|
|
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
|
|
WIKI_URL="http://${{ secrets.GITHUB_TOKEN }}@172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
else
|
|
WIKI_URL="http://172.0.0.29:3000/sarman/tftsr-devops_investigation.wiki.git"
|
|
fi
|
|
|
|
# Push to wiki
|
|
if git push "$WIKI_URL" master; then
|
|
echo "✓ Wiki successfully synced"
|
|
else
|
|
echo "⚠ Wiki push failed - you may need to configure authentication"
|
|
echo " To enable automatic wiki sync, add a Gitea token with repository write access"
|
|
exit 1
|
|
fi
|