From 3ed88c71db3f18a367db6d5f5e5e2249ba5f0c37 Mon Sep 17 00:00:00 2001 From: Luke McCrone Date: Thu, 2 Jul 2026 18:51:28 -0300 Subject: [PATCH] test: go generateCommand executable, different platform tests, install scripts --- .github/workflows/system-macos-15-intel.yml | 215 ++++++++++++++++++++ .github/workflows/system-macos-15.yml | 215 ++++++++++++++++++++ .github/workflows/system-ubuntu-arm.yml | 194 ++++++++++++++++++ tests/install_base_dependencies.sh | 2 +- 4 files changed, 625 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/system-macos-15-intel.yml create mode 100644 .github/workflows/system-macos-15.yml create mode 100644 .github/workflows/system-ubuntu-arm.yml diff --git a/.github/workflows/system-macos-15-intel.yml b/.github/workflows/system-macos-15-intel.yml new file mode 100644 index 00000000..a6a50d18 --- /dev/null +++ b/.github/workflows/system-macos-15-intel.yml @@ -0,0 +1,215 @@ +name: MacOS 15 Intel s3cmd test +permissions: {} +on: pull_request +jobs: + build: + name: RunTests + runs-on: macos-15-intel + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v7 + + - name: Install base dependencies + run: | + ./tests/install_base_dependencies.sh + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "stable" + id: go + + - name: Get Dependencies + run: | + go get -v -t -d ./... + + - name: Upgrade bash + run: | + brew install bash + echo "$(brew --prefix)/bin" >> "$GITHUB_PATH" + + - name: Install BATS + run: | + git clone https://github.com/bats-core/bats-core.git + cd bats-core && ./install.sh ${{ github.workspace }} + git clone https://github.com/bats-core/bats-support.git ${{ github.workspace }}/tests/bats-support + git clone https://github.com/ztombol/bats-assert.git ${{ github.workspace }}/tests/bats-assert + + # disable mc tests due to dl.min.io instability + # - name: Install mc + # run: | + # curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o /usr/local/bin/mc + # chmod 755 /usr/local/bin/mc + + # see https://github.com/versity/versitygw/issues/1034 + - name: Install AWS cli + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.35.zip" -o "awscliv2.zip" + unzip -o awscliv2.zip + ./aws/install -i ${{ github.workspace }}/aws-cli -b ${{ github.workspace }}/bin + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - name: Create test user + run: | + sudo sysadminctl -addUser tester -shell /bin/bash -home /Users/tester -createHome + sudo mkdir -p /Users/tester/test-files + sudo chown -R tester:staff /Users/tester + + - name: Write env file for test user + env: + IAM_TYPE: folder + RUN_SET: tests/test_user_s3cmd.sh + AWS_PROFILE: versity + VERSITY_EXE: ${{ github.workspace }}/versitygw + RUN_VERSITYGW: true + BACKEND: posix + RECREATE_BUCKETS: true + DELETE_BUCKETS_AFTER_TEST: true + CERT: /Users/tester/test-files/cert.pem + KEY: /Users/tester/test-files/versitygw.pem + LOCAL_FOLDER: /tmp/gw + BUCKET_ONE_NAME: versity-gwtest-bucket-one + BUCKET_TWO_NAME: versity-gwtest-bucket-two + USERS_FOLDER: /Users/tester/test-files/iam + USERS_BUCKET: versity-gwtest-iam + AWS_ENDPOINT_URL: https://127.0.0.1:7070 + PORT: 7070 + S3CMD_CONFIG: tests/s3cfg.local.default + MC_ALIAS: versity + LOG_LEVEL: 4 + GOCOVERDIR: /Users/tester/test-files/cover + USERNAME_ONE: HIJKLMN + PASSWORD_ONE: 1234567 + USERNAME_TWO: OPQRSTU + PASSWORD_TWO: 8901234 + TEST_FILE_FOLDER: /Users/tester/test-files/versity-gwtest-files + REMOVE_TEST_FILE_FOLDER: true + VERSIONING_DIR: /Users/tester/test-files/versioning + COMMAND_LOG: /Users/tester/test-files/command.log + TIME_LOG: /Users/tester/test-files/time.log + PYTHON_ENV_FOLDER: /Users/tester/test-files/env + AUTOGENERATE_USERS: true + USER_AUTOGENERATION_PREFIX: github-actions-test- + AWS_REGION: us-east-1 + COVERAGE_LOG: /Users/tester/test-files/coverage.log + TEMPLATE_MATRIX_FILE: ${{ github.workspace }}/tests/templates/matrix.yaml + run: | + cat > /Users/runner/.env </dev/null || true + sleep 10 + kill -KILL -"$pid" 2>/dev/null || true + ) & + watchdog=$! + + wait "$pid" + status=$? + kill "$watchdog" 2>/dev/null || true + exit "$status" diff --git a/.github/workflows/system-macos-15.yml b/.github/workflows/system-macos-15.yml new file mode 100644 index 00000000..cc7835e3 --- /dev/null +++ b/.github/workflows/system-macos-15.yml @@ -0,0 +1,215 @@ +name: MacOS 15 s3cmd test +permissions: {} +on: pull_request +jobs: + build: + name: RunTests + runs-on: macos-15 + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v7 + + - name: Install base dependencies + run: | + ./tests/install_base_dependencies.sh + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "stable" + id: go + + - name: Get Go Dependencies + run: | + go get -v -t -d ./... + + - name: Upgrade bash + run: | + brew install bash + echo "$(brew --prefix)/bin" >> "$GITHUB_PATH" + + - name: Install BATS + run: | + git clone https://github.com/bats-core/bats-core.git + cd bats-core && ./install.sh ${{ github.workspace }} + git clone https://github.com/bats-core/bats-support.git ${{ github.workspace }}/tests/bats-support + git clone https://github.com/ztombol/bats-assert.git ${{ github.workspace }}/tests/bats-assert + + # disable mc tests due to dl.min.io instability + # - name: Install mc + # run: | + # curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o /usr/local/bin/mc + # chmod 755 /usr/local/bin/mc + + # see https://github.com/versity/versitygw/issues/1034 + - name: Install AWS cli + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.35.zip" -o "awscliv2.zip" + unzip -o awscliv2.zip + ./aws/install -i ${{ github.workspace }}/aws-cli -b ${{ github.workspace }}/bin + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - name: Create test user + run: | + sudo sysadminctl -addUser tester -shell /bin/bash -home /Users/tester -createHome + sudo mkdir -p /Users/tester/test-files + sudo chown -R tester:staff /Users/tester + + - name: Write env file for test user + env: + IAM_TYPE: folder + RUN_SET: tests/test_user_s3cmd.sh + AWS_PROFILE: versity + VERSITY_EXE: ${{ github.workspace }}/versitygw + RUN_VERSITYGW: true + BACKEND: posix + RECREATE_BUCKETS: true + DELETE_BUCKETS_AFTER_TEST: true + CERT: /Users/tester/test-files/cert.pem + KEY: /Users/tester/test-files/versitygw.pem + LOCAL_FOLDER: /tmp/gw + BUCKET_ONE_NAME: versity-gwtest-bucket-one + BUCKET_TWO_NAME: versity-gwtest-bucket-two + USERS_FOLDER: /Users/tester/test-files/iam + USERS_BUCKET: versity-gwtest-iam + AWS_ENDPOINT_URL: https://127.0.0.1:7070 + PORT: 7070 + S3CMD_CONFIG: tests/s3cfg.local.default + MC_ALIAS: versity + LOG_LEVEL: 4 + GOCOVERDIR: /Users/tester/test-files/cover + USERNAME_ONE: HIJKLMN + PASSWORD_ONE: 1234567 + USERNAME_TWO: OPQRSTU + PASSWORD_TWO: 8901234 + TEST_FILE_FOLDER: /Users/tester/test-files/versity-gwtest-files + REMOVE_TEST_FILE_FOLDER: true + VERSIONING_DIR: /Users/tester/test-files/versioning + COMMAND_LOG: /Users/tester/test-files/command.log + TIME_LOG: /Users/tester/test-files/time.log + PYTHON_ENV_FOLDER: /Users/tester/test-files/env + AUTOGENERATE_USERS: true + USER_AUTOGENERATION_PREFIX: github-actions-test- + AWS_REGION: us-east-1 + COVERAGE_LOG: /Users/tester/test-files/coverage.log + TEMPLATE_MATRIX_FILE: ${{ github.workspace }}/tests/templates/matrix.yaml + run: | + cat > /Users/runner/.env </dev/null || true + sleep 10 + kill -KILL -"$pid" 2>/dev/null || true + ) & + watchdog=$! + + wait "$pid" + status=$? + kill "$watchdog" 2>/dev/null || true + exit "$status" diff --git a/.github/workflows/system-ubuntu-arm.yml b/.github/workflows/system-ubuntu-arm.yml new file mode 100644 index 00000000..fe416f64 --- /dev/null +++ b/.github/workflows/system-ubuntu-arm.yml @@ -0,0 +1,194 @@ +name: Ubuntu ARM s3cmd test +permissions: {} +on: pull_request +jobs: + build: + name: RunTests + runs-on: ubuntu-24.04-arm + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v7 + + - name: Install base dependencies + run: | + ./tests/install_base_dependencies.sh + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "stable" + id: go + + - name: Get Go Dependencies + run: | + go get -v -t -d ./... + + - name: Install BATS + run: | + git clone https://github.com/bats-core/bats-core.git + cd bats-core && ./install.sh ${{ github.workspace }} + git clone https://github.com/bats-core/bats-support.git ${{ github.workspace }}/tests/bats-support + git clone https://github.com/ztombol/bats-assert.git ${{ github.workspace }}/tests/bats-assert + + # disable mc tests due to dl.min.io instability + # - name: Install mc + # run: | + # curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o /usr/local/bin/mc + # chmod 755 /usr/local/bin/mc + + # see https://github.com/versity/versitygw/issues/1034 + - name: Install AWS cli + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.22.35.zip" -o "awscliv2.zip" + unzip -o awscliv2.zip + ./aws/install -i ${{ github.workspace }}/aws-cli -b ${{ github.workspace }}/bin + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + + - name: Create test user + run: | + sudo useradd -m -s /bin/bash tester + sudo mkdir -p /home/tester/test-files + sudo chown -R tester:tester /home/tester + + - name: Write env file for test user + env: + IAM_TYPE: folder + RUN_SET: tests/test_user_s3cmd.sh + AWS_PROFILE: versity + VERSITY_EXE: ${{ github.workspace }}/versitygw + RUN_VERSITYGW: true + BACKEND: posix + RECREATE_BUCKETS: true + DELETE_BUCKETS_AFTER_TEST: true + CERT: /home/tester/test-files/cert.pem + KEY: /home/tester/test-files/versitygw.pem + LOCAL_FOLDER: /tmp/gw + BUCKET_ONE_NAME: versity-gwtest-bucket-one + BUCKET_TWO_NAME: versity-gwtest-bucket-two + USERS_FOLDER: /home/tester/test-files/iam + USERS_BUCKET: versity-gwtest-iam + AWS_ENDPOINT_URL: https://127.0.0.1:7070 + PORT: 7070 + S3CMD_CONFIG: tests/s3cfg.local.default + MC_ALIAS: versity + LOG_LEVEL: 4 + GOCOVERDIR: /home/tester/test-files/cover + USERNAME_ONE: HIJKLMN + PASSWORD_ONE: 1234567 + USERNAME_TWO: OPQRSTU + PASSWORD_TWO: 8901234 + TEST_FILE_FOLDER: /home/tester/test-files/versity-gwtest-files + REMOVE_TEST_FILE_FOLDER: true + VERSIONING_DIR: /home/tester/test-files/versioning + COMMAND_LOG: /home/tester/test-files/command.log + TIME_LOG: /home/tester/test-files/time.log + PYTHON_ENV_FOLDER: /home/tester/test-files/env + AUTOGENERATE_USERS: true + USER_AUTOGENERATION_PREFIX: github-actions-test- + AWS_REGION: us-east-1 + COVERAGE_LOG: /home/tester/test-files/coverage.log + TEMPLATE_MATRIX_FILE: ${{ github.workspace }}/tests/templates/matrix.yaml + run: | + cat > /home/tester/test-files/.env </dev/null || true + sleep 10 + kill -KILL -"$pid" 2>/dev/null || true + ) & + watchdog=$! + + wait "$pid" + status=$? + kill "$watchdog" 2>/dev/null || true + exit "$status" diff --git a/tests/install_base_dependencies.sh b/tests/install_base_dependencies.sh index bd6f2521..89fe4297 100755 --- a/tests/install_base_dependencies.sh +++ b/tests/install_base_dependencies.sh @@ -25,7 +25,7 @@ check_for_xcode() { install_mac_libraries() { if ! check_for_xcode; then - exit 1 + return 1 fi if ! command -v brew >/dev/null 2>&1; then