Some checks failed
CI / test-and-build (push) Failing after 1s
Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
2.0 KiB
YAML
60 lines
2.0 KiB
YAML
# CI only — never deploys production.
|
|
# Uses shell checkout to avoid marketplace action stalls on first-run VPS installs.
|
|
name: CI
|
|
on:
|
|
push:
|
|
branches: [main, master, develop]
|
|
pull_request:
|
|
branches: [main, master, develop]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test-and-build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout via git
|
|
run: |
|
|
set -euo pipefail
|
|
git clone --depth 1 --branch "${GITHUB_REF_NAME:-main}" \
|
|
"http://gitea:3000/tloto-admin/games_app.git" repo || \
|
|
git clone --depth 1 \
|
|
"http://172.16.0.1:3000/tloto-admin/games_app.git" repo
|
|
cd repo
|
|
git fetch --depth 1 origin "${GITHUB_SHA:-HEAD}" || true
|
|
git checkout -q "${GITHUB_SHA:-HEAD}" || git checkout -q HEAD
|
|
pwd
|
|
ls -la
|
|
|
|
- name: Backend install + compile
|
|
working-directory: repo/backend
|
|
run: |
|
|
set -euo pipefail
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Set image tag
|
|
id: meta
|
|
working-directory: repo
|
|
run: |
|
|
SHA="${GITHUB_SHA:-$(git rev-parse HEAD)}"
|
|
echo "sha=${SHA:0:12}" >> "$GITHUB_OUTPUT"
|
|
echo "full=$SHA" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and push images
|
|
working-directory: repo
|
|
env:
|
|
REGISTRY: 172.16.0.1:5000
|
|
run: |
|
|
set -euo pipefail
|
|
docker version
|
|
docker build -t ${REGISTRY}/tloto-backend:${{ steps.meta.outputs.sha }} ./backend
|
|
docker build \
|
|
--build-arg VITE_API_BASE_URL=http://127.0.0.1:9080 \
|
|
--build-arg VITE_WS_URL=ws://127.0.0.1:9080/ws/v1/games/candle-predict \
|
|
--build-arg VITE_WS_ENABLED=true \
|
|
-t ${REGISTRY}/tloto-web:${{ steps.meta.outputs.sha }} \
|
|
./prediqo_web
|
|
docker push ${REGISTRY}/tloto-backend:${{ steps.meta.outputs.sha }}
|
|
docker push ${REGISTRY}/tloto-web:${{ steps.meta.outputs.sha }}
|
|
echo "CI_OK ${{ steps.meta.outputs.sha }}"
|