fix: source .devpod-env for tool paths in ci-build
All checks were successful
CI Build / build (push) Successful in 25s
All checks were successful
CI Build / build (push) Successful in 25s
This commit is contained in:
parent
1edddadedd
commit
e7a9e74668
1 changed files with 42 additions and 12 deletions
|
|
@ -1,34 +1,64 @@
|
|||
# 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 (not actions/checkout) for host-mode runners.
|
||||
# Sources tool paths from .devpod-env since tools are in per-pod toolchains.
|
||||
name: CI Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: [self-hosted]
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
export PATH="/usr/local/go/bin:/home/dev/.cargo/bin:$PATH"
|
||||
[ -f /home/dev/.devpod-env ] && . /home/dev/.devpod-env
|
||||
git clone http://forgejo.dev-infra.svc:3000/${{ github.repository }}.git workspace
|
||||
cd workspace
|
||||
git checkout ${{ github.sha }}
|
||||
- name: Build
|
||||
|
||||
- name: Detect and build
|
||||
working-directory: workspace
|
||||
run: |
|
||||
export PATH="/usr/local/go/bin:/home/dev/.cargo/bin:$PATH"
|
||||
export GOPATH="/home/dev/go"
|
||||
export GOPROXY="http://athens.dev-infra.svc:3000,direct"
|
||||
[ -f /home/dev/.devpod-env ] && . /home/dev/.devpod-env
|
||||
set -e
|
||||
if [ -f "go.mod" ]; then
|
||||
|
||||
if [ -f "Cargo.toml" ]; then
|
||||
echo "Detected Rust project"
|
||||
cargo build --release
|
||||
cargo test
|
||||
elif [ -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
|
||||
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 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue