reductionist 0.13.1

S3 Active Storage server
Documentation
---
name: Pull request
on:
  push:
    branches:
      - main
    paths-ignore:
      - README.md
  pull_request:
    paths-ignore:
      - README.md
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Build
        run: make build
  docs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.x
      - name: Install mkdocs
        run: pip install -r docs/requirements.txt
      - run: mkdocs build --strict
  rustdocs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Build documentation
        run: make docs
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Lint
        run: make lint

      - name: Install ansible-lint
        run: pip install ansible-lint

      - name: Install Ansible Galaxy requirements
        run: ansible-galaxy collection install -r deployment/requirements.yml

      - name: Lint Ansible playbook
        run: ansible-lint deployment/site.yml
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - 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
          # Use the head ref for pull requests and the branch ref for pushes to main
          # This is useful for testing Reductionist and the compliance suite
          # whilst they are developed in parallel using like named branches
          #ref: ${{ github.head_ref || github.ref_name }}
          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/storage-start

      - name: Wait for minio object storage to start
        run: |
          until curl -if http://localhost:9001; do
            sleep 1;
          done

      - name: Create artifacts directory
        run: mkdir artifacts

      #####
      # Test without local disk cache
      #####

      - 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/reductionist-schema; do
            sleep 1;
          done

      - name: Run compliance test suite
        run: pytest -s > artifacts/pytest.log

      - name: Get active storage logs
        run: docker logs reductionist > artifacts/reductionist.log
        if: always()

      - name: Stop active storage container
        run: make stop
        if: always()

      #####
      # Test with local disk cache
      #####

      - name: Run active storage container with local disk cache
        run: make run-with-cache

      - name: Wait for active storage server to start
        run: |
          until curl -if http://localhost:8080/.well-known/reductionist-schema; do
            sleep 1;
          done

      - name: Run compliance test suite
        run: pytest -s > artifacts/pytest-with-cache.log

      - name: Get active storage logs
        run: docker logs reductionist > artifacts/reductionist-with-cache.log
        if: always()

      - name: Stop active storage container
        run: make stop
        if: always()

      #####
      # Clean up steps
      #####

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: compliance-test
          path: artifacts
        if: always()

      - name: Stop minio object storage
        run: scripts/storage-stop
        if: always()

  deployment-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup python
        uses: actions/setup-python@v4

      - name: Install deployment dependencies
        run: pip install -r deployment/requirements.txt

      - name: Install Ansible Galaxy requirements
        run: ansible-galaxy collection install -r deployment/requirements.yml

      - name: Run Ansible playbook
        run: ansible-playbook -i deployment/inventory deployment/site.yml

      - name: Install Python client dependencies
        run: pip install -r scripts/requirements.txt

      - name: Upload some sample data
        run: python ./scripts/upload_sample_data.py

      - name: Perform a smoke test
        run: >
          # Get the local IP of the default route
          ip=$(ip r get 8.8.8.8 | awk '/via/ { print $7 }') &&
          python ./scripts/client.py
          sum
          --server https://${ip}:8080
          --cacert root.crt
          --source http://localhost:9000
          --username minioadmin --password minioadmin
          --bucket sample-data --object data-uint32.dat
          --dtype uint32

      - name: Debug on failure
        run: |
          set -x
          set +e
          docker ps -a
          for container in $(docker ps -aq); do
            docker logs $container
          done
          sudo ss -nltp
          sudo cat /etc/haproxy/haproxy.cfg
          sudo cat /etc/prometheus/prometheus.yml
          sudo ip a
          sudo ip r
        if: failure()

  dependency-review:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request'
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Dependency Review
        uses: actions/dependency-review-action@v3
        with:
          # https://github.com/advisories/GHSA-g98v-hv3f-hcfr atty potential unaligned read on Windows
          allow-ghsas: GHSA-g98v-hv3f-hcfr