Skip to content

upd prepare.sh

upd prepare.sh #11

Workflow file for this run

name: Go Test Pipeline
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: project-sem-1
POSTGRES_USER: validator
POSTGRES_PASSWORD: val1dat0r
ports:
- 5432:5432
# Добавляем volume для сохранения данных
volumes:
- postgres_data:/var/lib/postgresql/data
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Make scripts executable
run: |
chmod +x scripts/prepare.sh
chmod +x scripts/run.sh
chmod +x scripts/tests.sh
- name: Prepare environment
run: ./scripts/prepare.sh
- name: Run application
run: ./scripts/run.sh
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: project-sem-1
POSTGRES_USER: validator
POSTGRES_PASSWORD: val1dat0r
- name: Test Level 1
id: test-level-1
continue-on-error: true
run: ./scripts/tests.sh 1
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: project-sem-1
POSTGRES_USER: validator
POSTGRES_PASSWORD: val1dat0r
- name: Test Level 2
id: test-level-2
continue-on-error: true
run: ./scripts/tests.sh 2
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: project-sem-1
POSTGRES_USER: validator
POSTGRES_PASSWORD: val1dat0r
- name: Test Level 3
id: test-level-3
continue-on-error: true
run: ./scripts/tests.sh 3
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: project-sem-1
POSTGRES_USER: validator
POSTGRES_PASSWORD: val1dat0r
- name: Check test results
if: always()
run: |
if [[ "${{ steps.test-level-1.outcome }}" == "success" ]] || \
[[ "${{ steps.test-level-2.outcome }}" == "success" ]] || \
[[ "${{ steps.test-level-3.outcome }}" == "success" ]]; then
echo "At least one test level passed successfully!"
exit 0
else
echo "All test levels failed!"
exit 1
fi