Skip to content

Commit 9cd4215

Browse files
authored
Merge pull request #311 from serpent213/ci-minio-e2e
CI: MinIO end-to-end tests
2 parents f0f87ff + ed2e12e commit 9cd4215

File tree

5 files changed

+538
-0
lines changed

5 files changed

+538
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: MinIO Integration Tests
2+
on: [push, pull_request]
3+
4+
env:
5+
OTP_VERSION: "27"
6+
ELIXIR_VERSION: "1.18"
7+
MINIO_VERSION: "RELEASE.2025-07-23T15-54-02Z"
8+
MIX_ENV: test
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
minio-integration:
15+
runs-on: ubuntu-24.04
16+
name: MinIO Integration Tests
17+
18+
steps:
19+
- name: Cache MinIO Docker image
20+
id: cache-minio
21+
uses: actions/cache@v4
22+
with:
23+
path: /tmp/docker-cache
24+
key: docker-minio-${{ runner.os }}-quay.io/minio/minio:${{ env.MINIO_VERSION }}
25+
26+
- name: Load MinIO from cache or pull
27+
run: |
28+
if [[ -f /tmp/docker-cache/minio.tar ]]; then
29+
echo "Loading MinIO image from cache"
30+
docker load < /tmp/docker-cache/minio.tar
31+
else
32+
echo "Pulling MinIO image and saving to cache"
33+
docker pull quay.io/minio/minio:${{ env.MINIO_VERSION }}
34+
mkdir -p /tmp/docker-cache
35+
docker save quay.io/minio/minio:${{ env.MINIO_VERSION }} > /tmp/docker-cache/minio.tar
36+
fi
37+
38+
- name: Start MinIO
39+
# Note: Port 9999 is dead, no round-trip tests
40+
run: |
41+
docker run -d \
42+
--name minio \
43+
-p 9000:9000 \
44+
-e "MINIO_ROOT_USER=minio" \
45+
-e "MINIO_ROOT_PASSWORD=miniosecret" \
46+
-e "MINIO_NOTIFY_WEBHOOK_ENABLE_testhook=on" \
47+
-e "MINIO_NOTIFY_WEBHOOK_ENDPOINT_testhook=http://localhost:9999" \
48+
quay.io/minio/minio:${{ env.MINIO_VERSION }} \
49+
server /data --address ":9000"
50+
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Set up Elixir
55+
uses: erlef/setup-beam@v1
56+
with:
57+
otp-version: ${{ env.OTP_VERSION }}
58+
elixir-version: ${{ env.ELIXIR_VERSION }}
59+
60+
- name: Restore Mix deps cache
61+
uses: actions/cache@v4
62+
with:
63+
path: |
64+
deps
65+
_build
66+
key: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
67+
restore-keys: |
68+
${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-
69+
70+
- name: Install dependencies
71+
run: mix deps.get
72+
73+
- name: Compile
74+
run: mix compile
75+
76+
- name: Ensure MinIO is ready
77+
run: |
78+
docker logs minio
79+
timeout 60s bash -c 'until curl -fs http://localhost:9000/minio/health/live >/dev/null; do echo "MinIO not ready yet..."; sleep 2; done'
80+
81+
- name: Run MinIO integration tests
82+
run: mix test.minio

config/runtime.exs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Config
2+
3+
if config_env() == :test and System.get_env("MIX_TEST_EX_AWS_MINIO") do
4+
config :ex_aws,
5+
access_key_id: System.get_env("MINIO_ROOT_USER") || "minio",
6+
secret_access_key: System.get_env("MINIO_ROOT_PASSWORD") || "miniosecret",
7+
s3: [
8+
scheme: "http://",
9+
host: System.get_env("MINIO_HOSTNAME") || "localhost",
10+
port: System.get_env("MINIO_PORT") || 9000,
11+
region: "us-east-1"
12+
]
13+
end

mix.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ defmodule ExAws.S3.Mixfile do
1313
elixir: "~> 1.13",
1414
elixirc_paths: elixirc_paths(Mix.env()),
1515
start_permanent: Mix.env() == :prod,
16+
aliases: aliases(),
1617
deps: deps(),
1718
name: @name,
1819
package: package(),
@@ -58,6 +59,12 @@ defmodule ExAws.S3.Mixfile do
5859
]
5960
end
6061

62+
defp aliases do
63+
[
64+
"test.minio": ["cmd env MIX_TEST_EX_AWS_MINIO=true mix test --only minio"]
65+
]
66+
end
67+
6168
defp ex_aws() do
6269
case System.get_env("AWS") do
6370
"LOCAL" -> {:ex_aws, path: "../ex_aws"}

0 commit comments

Comments
 (0)