Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/minio-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: MinIO Integration Tests
on: [push, pull_request]

env:
OTP_VERSION: "27"
ELIXIR_VERSION: "1.18"
MINIO_VERSION: "RELEASE.2025-07-23T15-54-02Z"
MIX_ENV: test

permissions:
contents: read

jobs:
minio-integration:
runs-on: ubuntu-24.04
name: MinIO Integration Tests

steps:
- name: Cache MinIO Docker image
id: cache-minio
uses: actions/cache@v4
with:
path: /tmp/docker-cache
key: docker-minio-${{ runner.os }}-quay.io/minio/minio:${{ env.MINIO_VERSION }}

- name: Load MinIO from cache or pull
run: |
if [[ -f /tmp/docker-cache/minio.tar ]]; then
echo "Loading MinIO image from cache"
docker load < /tmp/docker-cache/minio.tar
else
echo "Pulling MinIO image and saving to cache"
docker pull quay.io/minio/minio:${{ env.MINIO_VERSION }}
mkdir -p /tmp/docker-cache
docker save quay.io/minio/minio:${{ env.MINIO_VERSION }} > /tmp/docker-cache/minio.tar
fi

- name: Start MinIO
# Note: Port 9999 is dead, no round-trip tests
run: |
docker run -d \
--name minio \
-p 9000:9000 \
-e "MINIO_ROOT_USER=minio" \
-e "MINIO_ROOT_PASSWORD=miniosecret" \
-e "MINIO_NOTIFY_WEBHOOK_ENABLE_testhook=on" \
-e "MINIO_NOTIFY_WEBHOOK_ENDPOINT_testhook=http://localhost:9999" \
quay.io/minio/minio:${{ env.MINIO_VERSION }} \
server /data --address ":9000"

- name: Checkout code
uses: actions/checkout@v4

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}

- name: Restore Mix deps cache
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-

- name: Install dependencies
run: mix deps.get

- name: Compile
run: mix compile

- name: Ensure MinIO is ready
run: |
docker logs minio
timeout 60s bash -c 'until curl -fs http://localhost:9000/minio/health/live >/dev/null; do echo "MinIO not ready yet..."; sleep 2; done'

- name: Run MinIO integration tests
run: mix test.minio
13 changes: 13 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Config

if config_env() == :test and System.get_env("MIX_TEST_EX_AWS_MINIO") do
config :ex_aws,
access_key_id: System.get_env("MINIO_ROOT_USER") || "minio",
secret_access_key: System.get_env("MINIO_ROOT_PASSWORD") || "miniosecret",
s3: [
scheme: "http://",
host: System.get_env("MINIO_HOSTNAME") || "localhost",
port: System.get_env("MINIO_PORT") || 9000,
region: "us-east-1"
]
end
7 changes: 7 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule ExAws.S3.Mixfile do
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
name: @name,
package: package(),
Expand Down Expand Up @@ -58,6 +59,12 @@ defmodule ExAws.S3.Mixfile do
]
end

defp aliases do
[
"test.minio": ["cmd env MIX_TEST_EX_AWS_MINIO=true mix test --only minio"]
]
end

defp ex_aws() do
case System.get_env("AWS") do
"LOCAL" -> {:ex_aws, path: "../ex_aws"}
Expand Down
Loading