diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index af77d03..3d228ec 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -49,21 +49,6 @@ jobs: --health-timeout 5s --health-retries 5 - localstack: - image: localstack/localstack:latest - env: - SERVICES: s3 - AWS_ACCESS_KEY_ID: ${{ secrets.GARAGE_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.GARAGE_SECRET }} - AWS_DEFAULT_REGION: ${{ secrets.GARAGE_REGION }} - options: >- - --health-cmd "curl -f http://localhost:4566/_localstack/health || exit 1" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 3900:3900 - steps: - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 @@ -82,6 +67,30 @@ jobs: docker ps -a echo "Docker environment check complete." + - name: Setup LocalStack S3 + run: | + # Install AWS CLI + sudo apt-get update + sudo apt-get install -y awscli + + # Wait for LocalStack + until curl -s http://localhost:4566/_localstack/health | grep -q '"s3":"available"'; do + sleep 2 + 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 @@ -96,7 +105,7 @@ jobs: 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-bucket" + S3_BUCKET_NAME: "soaricarus-ci-bucket" S3_ENDPOINT_URL: "http://localhost:3900" run: | mkdir -p ~/.ssh