diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 55b3470..f74e0f4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,8 +1,10 @@ --- name: Pull request on: - - push - - pull_request + push: + branches: + - main + pull_request: jobs: build: runs-on: ubuntu-latest @@ -20,3 +22,72 @@ jobs: - name: Test run: make test + compliance-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build + run: make build + + - name: Checkout compliance test suite + uses: actions/checkout@v3 + with: + repository: stackhpc/s3-active-storage-compliance-suite + path: compliance + + - name: Setup python + uses: actions/setup-python@v4 + + - name: Install compliance test suite dependencies + run: pip install -r requirements.txt + working-directory: compliance + + - name: Configure compliance test suite + run: | + echo 'PROXY_URL = "http://localhost:8080"' >> compliance/config.py + working-directory: compliance + + - name: Start minio object storage + run: scripts/minio-start + + - name: Wait for minio object storage to start + run: | + until curl -if http://localhost:9001; do + sleep 1; + done + + - name: Run active storage container + run: make run + + - name: Wait for active storage server to start + run: | + until curl -if http://localhost:8080/.well-known/s3-active-storage-schema; do + sleep 1; + done + + - name: Create artifacts directory + run: mkdir artifacts + + - name: Run compliance test suite + run: pytest -s > artifacts/pytest.log + + - name: Get active storage logs + run: docker logs s3-active-storage > artifacts/s3-active-storage.log + if: always() + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: compliance-test + path: artifacts + if: always() + + - name: Stop minio object storage + run: scripts/minio-stop + if: always() + + - name: Stop active storage container + run: make stop + if: always() diff --git a/Dockerfile b/Dockerfile index a72b8df..420345d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,5 +10,9 @@ RUN cargo install --path . # Stage 2: final image FROM debian:bullseye-slim +# AWS SDK requires CA certificates to be present. +RUN apt update \ + && apt install -y --no-install-recommends ca-certificates \ + && update-ca-certificates COPY --from=builder /usr/local/cargo/bin/s3-active-storage /usr/local/bin/s3-active-storage CMD ["s3-active-storage"] diff --git a/Makefile b/Makefile index 13a8ab1..f747890 100644 --- a/Makefile +++ b/Makefile @@ -10,4 +10,8 @@ test: .PHONY: run run: - @docker run -it --rm --net=host --name s3-active-storage s3-active-storage + @docker run -it --detach --rm --net=host --name s3-active-storage s3-active-storage + +.PHONY: stop +stop: + @docker stop s3-active-storage diff --git a/scripts/minio-run b/scripts/minio-run deleted file mode 100755 index 53aeb6b..0000000 --- a/scripts/minio-run +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# REPO_ROOT="$(dirname $(dirname $(realpath ${BASH_SOURCE[0]:-${(%):-%x}})))" #Doesn't work on MacOS / zsh shell -# REPO_ROOT="$(pwd)" #Use this instead then upload data to minio manually if needed -# echo "Data directory for minio instance: $REPO_ROOT/testdata" - -# exec docker run \ -# --rm \ -# -p 9000:9000 \ -# -p 9001:9001 \ -# -v "$REPO_ROOT/testdata:/data" \ -# minio/minio \ -# server \ -# /data \ -# --console-address ":9001" - -# Use anon storage volume so that test data is removed when container is stopped -exec docker run --rm -p 9000:9000 -p 9001:9001 -v :/data minio/minio server data --console-address ":9001" diff --git a/scripts/minio-start b/scripts/minio-start new file mode 100755 index 0000000..16aecaa --- /dev/null +++ b/scripts/minio-start @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +# Use anon storage volume so that test data is removed when container is stopped +exec docker run --detach --rm -p 9000:9000 -p 9001:9001 -v :/data --name minio minio/minio server data --console-address ":9001" diff --git a/scripts/minio-stop b/scripts/minio-stop new file mode 100755 index 0000000..663b8b4 --- /dev/null +++ b/scripts/minio-stop @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +exec docker stop minio