fix: add working-directory to ci-build for host-mode runners
Some checks failed
CI Build / build (push) Failing after 1s
Some checks failed
CI Build / build (push) Failing after 1s
This commit is contained in:
parent
b374389eff
commit
63b8a2bfc1
1 changed files with 41 additions and 8 deletions
|
|
@ -1,7 +1,13 @@
|
||||||
|
# Forgejo Actions workflow: build on merge to main.
|
||||||
|
# Triggered on push to main branch. Detects the project language and runs
|
||||||
|
# the appropriate build command.
|
||||||
|
# Uses plain git clone instead of actions/checkout@v4 for host-mode runners.
|
||||||
name: CI Build
|
name: CI Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: [self-hosted]
|
runs-on: [self-hosted]
|
||||||
|
|
@ -11,17 +17,44 @@ jobs:
|
||||||
git clone http://forgejo.dev-infra.svc:3000/${{ github.repository }}.git workspace
|
git clone http://forgejo.dev-infra.svc:3000/${{ github.repository }}.git workspace
|
||||||
cd workspace
|
cd workspace
|
||||||
git checkout ${{ github.sha }}
|
git checkout ${{ github.sha }}
|
||||||
- name: Build
|
|
||||||
|
- name: Detect and build
|
||||||
working-directory: workspace
|
working-directory: workspace
|
||||||
run: |
|
run: |
|
||||||
if [ -f "go.mod" ]; then
|
set -e
|
||||||
echo "Detected Go project"
|
|
||||||
go build ./...
|
if [ -f "Cargo.toml" ]; then
|
||||||
echo "Build succeeded"
|
|
||||||
go test ./... || echo "Tests completed"
|
|
||||||
elif [ -f "Cargo.toml" ]; then
|
|
||||||
echo "Detected Rust project"
|
echo "Detected Rust project"
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
cargo test
|
||||||
|
elif [ -f "go.mod" ]; then
|
||||||
|
echo "Detected Go project"
|
||||||
|
go build ./...
|
||||||
|
go test ./...
|
||||||
|
elif [ -f "package.json" ]; then
|
||||||
|
echo "Detected Node.js project"
|
||||||
|
if [ -f "bun.lockb" ] || [ -f "bun.lock" ]; then
|
||||||
|
bun install
|
||||||
|
bun run build 2>/dev/null || true
|
||||||
|
bun test 2>/dev/null || true
|
||||||
|
else
|
||||||
|
npm ci
|
||||||
|
npm run build 2>/dev/null || true
|
||||||
|
npm test 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
elif [ -f "Makefile" ]; then
|
||||||
|
echo "Detected Makefile project"
|
||||||
|
make
|
||||||
else
|
else
|
||||||
echo "No build system found"
|
echo "No recognized build system found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Report status
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
if [ "${{ job.status }}" = "success" ]; then
|
||||||
|
echo "Build succeeded"
|
||||||
|
else
|
||||||
|
echo "Build failed"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue