Repository navigation
feat: storage streaming (#22) #50
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: elixir | |
| "on": | |
| pull_request: | |
| push: | |
| branches: [main] | |
| env: | |
| MIX_ENV: test | |
| DATABASE_USER: postgres | |
| DATABASE_PASSWORD: postgres | |
| DATABASE_HOST: localhost | |
| DATABASE_PORT: 5432 | |
| DATABASE_TEST_NAME: textbin_test | |
| OTP_VERSION: "28.5" | |
| ELIXIR_VERSION: "1.20" | |
| jobs: | |
| lint: | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ env.OTP_VERSION }} | |
| elixir-version: ${{ env.ELIXIR_VERSION }} | |
| - name: Cache Mix dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: mix-lint-${{ runner.os }}-${{ hashFiles('mix.lock') }} | |
| restore-keys: | | |
| mix-lint-${{ runner.os }}- | |
| mix-${{ runner.os }}- | |
| - name: Install Hex and Rebar | |
| run: | | |
| mix local.hex --force | |
| mix local.rebar --force | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Linter | |
| run: mix credo | |
| format: | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ env.OTP_VERSION }} | |
| elixir-version: ${{ env.ELIXIR_VERSION }} | |
| - name: Cache Mix dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: mix-format-${{ runner.os }}-${{ hashFiles('mix.lock') }} | |
| restore-keys: | | |
| mix-format-${{ runner.os }}- | |
| mix-${{ runner.os }}- | |
| - name: Install Hex and Rebar | |
| run: | | |
| mix local.hex --force | |
| mix local.rebar --force | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Check formatting | |
| run: mix format --check-formatted | |
| test: | |
| name: "Test (store: ${{ matrix.storage-backend }})" | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| storage-backend: [memory, local, s3] | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: textbin_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d textbin_test" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ env.OTP_VERSION }} | |
| elixir-version: ${{ env.ELIXIR_VERSION }} | |
| - name: Cache Mix dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| key: >- | |
| mix-test-${{ matrix.storage-backend }}-${{ hashFiles('mix.lock') }} | |
| restore-keys: | | |
| mix-test-${{ matrix.storage-backend }}- | |
| mix-test- | |
| mix- | |
| - name: Install Hex and Rebar | |
| run: | | |
| mix local.hex --force | |
| mix local.rebar --force | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Compile | |
| run: mix compile --warnings-as-errors | |
| - name: Check unused dependencies | |
| run: mix deps.unlock --check-unused | |
| - name: Start SeaweedFS | |
| if: matrix.storage-backend == 's3' | |
| run: | | |
| docker compose up -d object-storage | |
| for attempt in $(seq 1 30); do | |
| if curl --silent --show-error \ | |
| --output /dev/null http://127.0.0.1:8333/; then | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| docker compose logs object-storage | |
| exit 1 | |
| - name: Run tests with ${{ matrix.storage-backend }} storage | |
| env: | |
| STORAGE_BACKEND: ${{ matrix.storage-backend }} | |
| TEXTBIN_STORAGE_PATH: ${{ runner.temp }}/textbin-storage | |
| S3_ENDPOINT: http://localhost:8333 | |
| S3_BUCKET: textbin | |
| S3_REGION: us-east-1 | |
| S3_ACCESS_KEY_ID: textbin | |
| S3_SECRET_ACCESS_KEY: textbin-development-secret | |
| run: | | |
| if [ "$STORAGE_BACKEND" = "memory" ]; then | |
| unset TEXTBIN_STORAGE_BACKEND | |
| else | |
| export TEXTBIN_STORAGE_BACKEND="$STORAGE_BACKEND" | |
| fi | |
| mix test |