fix: add PATH env 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
63b8a2bfc1
commit
b549710983
1 changed files with 15 additions and 40 deletions
|
|
@ -1,60 +1,35 @@
|
|||
# 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
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted]
|
||||
env:
|
||||
PATH: /usr/local/go/bin:/home/dev/.cargo/bin:/home/dev/.bun/bin:/usr/local/bin:/usr/bin:/bin
|
||||
GOPATH: /home/dev/go
|
||||
GOPROXY: http://athens.dev-infra.svc:3000,direct
|
||||
HOME: /home/dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone http://forgejo.dev-infra.svc:3000/${{ github.repository }}.git workspace
|
||||
cd workspace
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
- name: Detect and build
|
||||
- name: Build
|
||||
working-directory: workspace
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -f "Cargo.toml" ]; then
|
||||
if [ -f "go.mod" ]; then
|
||||
echo "Detected Go project"
|
||||
go version
|
||||
go build ./...
|
||||
echo "Build succeeded"
|
||||
go test ./...
|
||||
echo "Tests passed"
|
||||
elif [ -f "Cargo.toml" ]; then
|
||||
echo "Detected Rust project"
|
||||
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
|
||||
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"
|
||||
echo "No build system found"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue