From f85e978b6e4c71ba34a998e8015c6c7c5037225b Mon Sep 17 00:00:00 2001 From: Alan Liddell Date: Wed, 31 Jul 2024 13:12:20 -0400 Subject: [PATCH] S3 in CI (#201) This PR does 2 things: - Runs tests on the `pull_request` target rather than `pull_request_target` target and removes the automerge job. - Adds a workflow which spins up an S3 server in CI. It doesn't do much yet, but we would like to see it running and not failing. --- .github/workflows/test_pr.yml | 34 +-------------------------- .github/workflows/test_s3.yml | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/test_s3.yml diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml index 013799d..844993f 100644 --- a/.github/workflows/test_pr.yml +++ b/.github/workflows/test_pr.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request_target: + pull_request: branches: - main @@ -281,35 +281,3 @@ jobs: - name: Run stubtest on typed modules run: stubtest acquire - - merge: - name: Automerge - runs-on: "ubuntu-latest" - needs: - - platforms - - dcam - # - egrabber - - spinnaker - - pvcam - - typing - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Checkout PR - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - name: Approve PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.PAT }} - - # Don't auto-merge major version updates - - name: Merge PR - if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.PAT }} diff --git a/.github/workflows/test_s3.yml b/.github/workflows/test_s3.yml new file mode 100644 index 0000000..1e845ba --- /dev/null +++ b/.github/workflows/test_s3.yml @@ -0,0 +1,44 @@ +name: Test S3 + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + s3: + name: Test S3 functionality + runs-on: ubuntu-latest + env: + MINIO_ROOT_USER: admin + MINIO_ROOT_PASSWORD: password + MINIO_URL: http://localhost:9000 + MINIO_ALIAS: myminio + MINIO_ACCESS_KEY: acquire + MINIO_SECRET_KEY: 12345678 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install minio and mcli + run: | + apt update && apt install -y tmux wget + wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio + wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mcli + chmod +x /usr/local/bin/minio + chmod +x /usr/local/bin/mcli + + - name: Start minio in tmux + run: | + tmux new -d -s minio + tmux send-keys -t minio "MINIO_ROOT_USER=$MINIO_ROOT_USER MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD minio server /tmp/minio --console-address :9001" Enter + sleep 5 + mcli alias set $MINIO_ALIAS $MINIO_URL $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD + mcli admin user svcacct add --access-key $MINIO_ACCESS_KEY --secret-key $MINIO_SECRET_KEY $MINIO_ALIAS $MINIO_ROOT_USER