Skip to content

Add support for macOS runners #87

Add support for macOS runners

Add support for macOS runners #87

Workflow file for this run

name: Run automated tests
on:
push:
branches:
- master
pull_request:
branches:
- master
- support/**
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
release:
types:
- published
workflow_dispatch:
env:
TESTS_DATA_DIR: './tests/data'
permissions: write-all
jobs:
run_system_tests:
runs-on: ${{ matrix.os.runner }}
strategy:
fail-fast: false
matrix:
os: [{runner: 'ubuntu-latest'}, {runner: 'macos-14'}]
timeout-minutes: 500
steps:
- name: Get the current date
id: date
shell: bash
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
- name: Set url prefix
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "URL_PREFIX=${{ github.run_number }}-$TIMESTAMP" >> $GITHUB_ENV
- name: Set attributes
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "NEOFS_ATTRIBUTES=RunNumber=${{ github.run_number }}-$TIMESTAMP,Type=action_test_files" >> $GITHUB_ENV
- name: Checkout gh-push-to-neofs
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11.6'
- run: python --version
- name: Prepare venv
shell: bash
id: prepare_venv
run: |
python3 -m venv venv
source venv/bin/activate && pip install -r requirements.txt
working-directory: ./tests
- name: Run gh-push-to-neofs with url prefix
id: gh_push_to_neofs_with_url_prefix
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
URL_PREFIX: ${{ env.URL_PREFIX }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_with_url_prefix.outputs.OUTPUT_CONTAINER_URL }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL"
working-directory: ./tests
- name: Run gh-push-to-neofs without attributes
id: gh_push_to_neofs_without_attributes
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
URL_PREFIX: ${{ env.URL_PREFIX }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_with_url_prefix.outputs.OUTPUT_CONTAINER_URL }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL"
working-directory: ./tests
- name: Prepare directory name for tests without url prefix
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "PREFIX_DIR=${{ github.run_number }}-$TIMESTAMP-$(uuidgen)" >> $GITHUB_ENV
- name: Create a directory tree for tests with url prefix
shell: bash
run: |
mkdir "$PREFIX_DIR"
- name: Move files to the directory tree for tests with url prefix
shell: bash
env:
SOURCE_DIR: ${{ env.TESTS_DATA_DIR }}
DEST_DIR: ${{ env.PREFIX_DIR }}
run: |
rsync -av "$SOURCE_DIR" "$DEST_DIR"
- name: Run gh-push-to-neofs without url prefix
id: gh_push_to_neofs_without_url_prefix
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.PREFIX_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_without_url_prefix.outputs.OUTPUT_CONTAINER_URL }}
REPORT_DIR: ${{ env.PREFIX_DIR }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL" --report_dir="$REPORT_DIR"
working-directory: ./tests
- name: Prepare directory name for tests with object by object replacement
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "REPL_DATA_DIR=${{ github.run_number }}-$TIMESTAMP-$(uuidgen)-obj-by-obj-replacement" >> $GITHUB_ENV
- name: Create a directory tree for tests with objects replacement
shell: bash
run: |
mkdir "$REPL_DATA_DIR"
- name: Move files to the directory tree for tests with url prefix
shell: bash
env:
SOURCE_DIR: ${{ env.TESTS_DATA_DIR }}
DEST_DIR: ${{ env.REPL_DATA_DIR }}
run: |
cp -a "$SOURCE_DIR" "$DEST_DIR"
- name: Run gh-push-to-neofs with pre objects replacement
id: gh_push_to_neofs_with_pre_replace_objects
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REPL_DATA_DIR }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
- name: Modify test data
shell: bash
env:
DATA_DIR: ${{ env.REPL_DATA_DIR }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
find $DATA_DIR -type f -name '*.txt' -exec sed -i '$ s/$/_replaced_obj_by_obj/' {} +
elif [ "$RUNNER_OS" == "macOS" ]; then
find $DATA_DIR -type f -name '*.txt' -exec sed -i '' '$ s/$/_replaced_obj_by_obj/' {} +
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Run gh-push-to-neofs with objects replacement
id: gh_push_to_neofs_with_replace_objects
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REPL_DATA_DIR }}
REPLACE_OBJECTS: True
REPLACE_CONTAINER_CONTENTS: False
- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_with_replace_objects.outputs.OUTPUT_CONTAINER_URL }}
REPORT_DIR: ${{ env.REPL_DATA_DIR }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL" --report_dir="$REPORT_DIR" --data_dir_prefix=../$REPORT_DIR
working-directory: ./tests
- name: Prepare directory name for tests with entire container rewrite
shell: bash
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: |
echo "REWRITE_CONT_DIR=${{ github.run_number }}-$TIMESTAMP-$(uuidgen)-cont-rewrite" >> $GITHUB_ENV
- name: Create a directory tree for tests with objects replacement
shell: bash
run: |
mkdir "$REWRITE_CONT_DIR"
- name: Move files to the directory tree for tests with url prefix
shell: bash
env:
SOURCE_DIR: ${{ env.TESTS_DATA_DIR }}
DEST_DIR: ${{ env.REWRITE_CONT_DIR }}
run: |
cp -a "$SOURCE_DIR" "$DEST_DIR"
- name: Run gh-push-to-neofs with pre objects replacement
id: gh_push_to_neofs_with_pre_cont_rewrite
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REWRITE_CONT_DIR }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
- name: Modify test data
shell: bash
env:
DATA_DIR: ${{ env.REWRITE_CONT_DIR }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
find $DATA_DIR -type f -name '*.txt' -exec sed -i '$ s/$/_cont_rewrite/' {} +
elif [ "$RUNNER_OS" == "macOS" ]; then
find $DATA_DIR -type f -name '*.txt' -exec sed -i '' '$ s/$/_cont_rewrite/' {} +
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Run gh-push-to-neofs with objects replacement
id: gh_push_to_neofs_with_cont_rewrite
uses: ./
with:
NEOFS_WALLET: ${{ secrets.NEOFS_WALLET }}
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REWRITE_CONT_DIR }}
REPLACE_OBJECTS: True
REPLACE_CONTAINER_CONTENTS: True
- name: Run tests
env:
OUTPUT_CONTAINER_URL: ${{ steps.gh_push_to_neofs_with_cont_rewrite.outputs.OUTPUT_CONTAINER_URL }}
REPORT_DIR: ${{ env.REWRITE_CONT_DIR }}
run: |
source venv/bin/activate && pytest test_downloads.py --base_url="$OUTPUT_CONTAINER_URL" --report_dir="$REPORT_DIR" --data_dir_prefix=../$REPORT_DIR
working-directory: ./tests
- name: Run obj count test
env:
NEOFS_WALLET: "../wallet.json"
NEOFS_WALLET_PASSWORD: ${{ secrets.NEOFS_WALLET_PASSWORD }}
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
run: |
source venv/bin/activate && pytest test_objects.py
working-directory: ./tests