From 7677fe0e9db1e07170a62d267b5e37e8e7614019 Mon Sep 17 00:00:00 2001 From: YASSERRMD Date: Mon, 18 May 2026 23:39:02 +0400 Subject: [PATCH] ci: add GitHub Actions workflow for lint, test, build --- .github/workflows/ci.yml | 92 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8b67982 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,92 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + GO_VERSION: '1.25' + NODE_VERSION: '20' + +jobs: + backend-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: go vet ./... + working-directory: backend + + backend-test: + runs-on: ubuntu-latest + services: + postgres: + image: postgis/postgis:16-3.4 + env: + POSTGRES_DB: sunpath + POSTGRES_USER: sunpath + POSTGRES_PASSWORD: sunpath + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready -U sunpath + --health-interval 5s + --health-timeout 3s + --health-retries 5 + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 3s + --health-retries 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: go test ./... -count=1 -v 2>&1 | tail -30 + working-directory: backend + env: + DATABASE_URL: postgres://sunpath:sunpath@localhost:5432/sunpath?sslmode=disable + REDIS_URL: redis://localhost:6379/0 + + backend-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - run: go build ./... + working-directory: backend + + frontend-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm ci + working-directory: frontend + - run: npx tsc --noEmit + working-directory: frontend + + frontend-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm ci + working-directory: frontend + - run: npm run build + working-directory: frontend