Obj str do it #255
@@ -0,0 +1,118 @@
|
||||
name: pr CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key
|
||||
chmod 600 ~/.ssh/soaricarus_models_deploy_key
|
||||
ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
eval $(ssh-agent -s)
|
||||
ssh-add -v ~/.ssh/soaricarus_models_deploy_key
|
||||
|
||||
cargo check
|
||||
|
||||
test:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 20
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:18.4-alpine
|
||||
env:
|
||||
POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }}
|
||||
POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}
|
||||
POSTGRES_DB: ${{ secrets.DB_TEST_NAME || 'testdb' }}
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Verify Docker Environment
|
||||
run: |
|
||||
echo "Runner User Info:"
|
||||
id
|
||||
echo "Checking Docker Version:"
|
||||
docker --version
|
||||
echo "Checking Docker Daemon Status (info):"
|
||||
docker info
|
||||
echo "Checking Docker Daemon Status (ps):"
|
||||
docker ps -a
|
||||
echo "Docker environment check complete."
|
||||
|
||||
- name: Setup LocalStack S3
|
||||
run: |
|
||||
# Install AWS CLI
|
||||
sudo apt update
|
||||
sudo apt search awscli
|
||||
pip install awscli
|
||||
|
||||
# Wait for LocalStack
|
||||
until curl -s http://localhost:4566/_localstack/health | grep -q '"s3":"available"'; do
|
||||
sleep 3
|
||||
done
|
||||
|
||||
# CHOOSE A BUCKET NAME - this is whatever you want
|
||||
BUCKET_NAME="soaricarus-ci-bucket" # <-- CHANGE THIS TO WHAT YOUR APP EXPECTS
|
||||
|
||||
# Create the bucket
|
||||
aws --endpoint-url=http://localhost:4566 s3 mb s3://$BUCKET_NAME --region ${{ secrets.GARAGE_REGION }}
|
||||
|
||||
# Set it as an environment variable for the test step
|
||||
echo "BUCKET_NAME=$BUCKET_NAME" >> $GITHUB_ENV
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.GARAGE_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.GARAGE_SECRET }}
|
||||
AWS_DEFAULT_REGION: ${{ secrets.GARAGE_REGION }}
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
# Define DATABASE_URL for tests to use
|
||||
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
|
||||
RUST_LOG: info # Optional: configure test log level
|
||||
SECRET_MAIN_KEY: ${{ secrets.TOKEN_SECRET_KEY }}
|
||||
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }}
|
||||
ROOT_DIRECTORY: "/tmp"
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.GARAGE_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.GARAGE_SECRET }}
|
||||
AWS_DEFAULT_REGION: ${{ secrets.GARAGE_REGION }}
|
||||
GARAGE_DEFAULT_ACCESS_KEY: ${{ secrets.GARAGE_KEY_ID }}
|
||||
GARAGE_DEFAULT_SECRET_KEY: ${{ secrets.GARAGE_SECRET }}
|
||||
GARAGE_S3_REGION: ${{ secrets.GARAGE_REGION }}
|
||||
S3_BUCKET_NAME: "soaricarus-ci-bucket"
|
||||
S3_ENDPOINT_URL: "http://localhost:3900"
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key
|
||||
chmod 600 ~/.ssh/soaricarus_models_deploy_key
|
||||
ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
eval $(ssh-agent -s)
|
||||
ssh-add -v ~/.ssh/soaricarus_models_deploy_key
|
||||
|
||||
cargo test
|
||||
@@ -3,8 +3,6 @@ name: soaricarus_api CI
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
Reference in New Issue
Block a user