Add public file access feature with prefix-based visibility #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| cache: true | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Run unit tests | |
| run: | | |
| # Run unit tests (exclude integration tests and cmd which has no tests) | |
| go test -race -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v '/integration' | grep -v '/cmd/') -v | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.txt | |
| fail_ci_if_error: false | |
| verbose: true | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| cache: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image for testing | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| load: true | |
| tags: selfhost_s3:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Start selfhost_s3 container | |
| run: | | |
| docker run -d \ | |
| --name selfhost_s3-test \ | |
| -p 9000:9000 \ | |
| -e S3_BUCKET=test-bucket \ | |
| -e S3_ACCESS_KEY=testkey \ | |
| -e S3_SECRET_KEY=testsecret \ | |
| -e S3_PORT=9000 \ | |
| -e S3_REGION=us-east-1 \ | |
| selfhost_s3:test | |
| - name: Wait for selfhost_s3 to be ready | |
| run: | | |
| echo "Waiting for selfhost_s3 to be ready..." | |
| for i in {1..30}; do | |
| if curl -f http://localhost:9000/health > /dev/null 2>&1; then | |
| echo "selfhost_s3 is ready!" | |
| break | |
| fi | |
| echo "Waiting for selfhost_s3... ($i/30)" | |
| sleep 2 | |
| done | |
| # Final check | |
| curl -f http://localhost:9000/health || exit 1 | |
| - name: Run integration tests | |
| run: | | |
| go test -race -timeout=5m ./integration/... -v | |
| - name: Show container logs on failure | |
| if: failure() | |
| run: docker logs selfhost_s3-test | |
| - name: Cleanup | |
| if: always() | |
| run: docker rm -f selfhost_s3-test || true |