name: Ubuntu AMD System Tests permissions: {} on: pull_request jobs: generate: runs-on: ubuntu-latest outputs: matrix: ${{ steps.make.outputs.matrix }} steps: - uses: actions/checkout@v7 - id: make run: | if ! matrix_output=$(tests/generate_matrix.sh 2>&1); then echo "error generating matrix: $matrix_output" exit 1 fi MATRIX_JSON=$(echo -n "$matrix_output" | jq -c . ) echo "matrix=$MATRIX_JSON" >> "$GITHUB_OUTPUT" build: name: RunTests needs: generate runs-on: ubuntu-latest strategy: fail-fast: false matrix: ${{ fromJson(needs.generate.outputs.matrix) }} 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: ${{ matrix.IAM_TYPE }} RUN_SET: ${{ matrix.RUN_SET }} AWS_PROFILE: versity VERSITY_EXE: ${{ github.workspace }}/versitygw RUN_VERSITYGW: true BACKEND: ${{ matrix.BACKEND }} RECREATE_BUCKETS: ${{ matrix.RECREATE_BUCKETS }} DELETE_BUCKETS_AFTER_TEST: ${{ matrix.DELETE_BUCKETS_AFTER_TEST }} 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: ${{ matrix.AWS_REGION }} 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" - name: Ensure coverage file exists, and generate working name id: prepare_coverage run: | touch /home/tester/test-files/coverage.log run_set="${{ matrix.RUN_SET }}" SAFE_RUN_SET="${run_set//\//-}" echo "safe_run_set=$SAFE_RUN_SET" >> $GITHUB_OUTPUT - name: Upload command coverage log uses: actions/upload-artifact@v7 with: name: coverage-${{ steps.prepare_coverage.outputs.safe_run_set }}-${{ matrix.RECREATE_BUCKETS }} path: /home/tester/test-files/coverage.log retention-days: 1 - name: Time report run: | if [ -e /home/tester/test-files/time.log ]; then cat /home/tester/test-files/time.log fi - name: Coverage report run: | go tool covdata percent -i=/home/tester/test-files/cover print-coverage: runs-on: ubuntu-latest needs: [build] steps: - name: Download all S3 ops artifacts uses: actions/download-artifact@v8 with: path: artifacts - name: Merge (sort | uniq) run: | find artifacts -type f -name coverage.log -exec sed '/^\s*$/d' {} \; | sort -u > combined-coverage.log echo "Command coverage:" cat combined-coverage.log