Skip to content

Commit

Permalink
Add support for macOS runners
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed May 13, 2024
1 parent 5b662e6 commit f29fe57
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ permissions: write-all

jobs:
run_system_tests:
runs-on: ubuntu-latest
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
Expand Down Expand Up @@ -72,7 +76,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
URL_PREFIX: ${{ env.URL_PREFIX }}
Expand All @@ -95,7 +99,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.TESTS_DATA_DIR }}
URL_PREFIX: ${{ env.URL_PREFIX }}
REPLACE_OBJECTS: False
Expand Down Expand Up @@ -137,7 +141,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.PREFIX_DIR }}
NEOFS_ATTRIBUTES: ${{ env.NEOFS_ATTRIBUTES }}
REPLACE_OBJECTS: False
Expand Down Expand Up @@ -180,7 +184,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REPL_DATA_DIR }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
Expand All @@ -190,7 +194,14 @@ jobs:
env:
DATA_DIR: ${{ env.REPL_DATA_DIR }}
run: |
find $DATA_DIR -type f -name '*.txt' -exec sed -i '$ s/$/_replaced_obj_by_obj/' {} +
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
Expand All @@ -201,7 +212,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REPL_DATA_DIR }}
REPLACE_OBJECTS: True
REPLACE_CONTAINER_CONTENTS: False
Expand Down Expand Up @@ -243,7 +254,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REWRITE_CONT_DIR }}
REPLACE_OBJECTS: False
REPLACE_CONTAINER_CONTENTS: False
Expand All @@ -253,7 +264,14 @@ jobs:
env:
DATA_DIR: ${{ env.REWRITE_CONT_DIR }}
run: |
find $DATA_DIR -type f -name '*.txt' -exec sed -i '$ s/$/_cont_rewrite/' {} +
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
Expand All @@ -264,7 +282,7 @@ jobs:
NEOFS_NETWORK_DOMAIN: ${{ vars.NEOFS_NETWORK_DOMAIN }}
NEOFS_HTTP_GATE: ${{ vars.NEOFS_HTTP_GATE }}
STORE_OBJECTS_CID: ${{ vars.STORE_OBJECTS_CID }}
LIFETIME: ${{ vars.LIFETIME }}
LIFETIME: 5
PATH_TO_FILES_DIR: ${{ env.REWRITE_CONT_DIR }}
REPLACE_OBJECTS: True
REPLACE_CONTAINER_CONTENTS: True
Expand Down
19 changes: 18 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,24 @@ outputs:
runs:
using: composite
steps:
- name: Download latest stable neofs-cli for uploading reports to NeoFS
- name: Download latest stable neofs-cli for uploading reports to NeoFS for Linux
uses: dsaltares/[email protected]
if: runner.os == 'Linux'
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/v0.38.1'
file: 'neofs-cli-amd64'
target: 'neofs/neofs-cli'

- name: Download latest stable neofs-cli for uploading reports to NeoFS for macOS
uses: dsaltares/[email protected]
if: runner.os == 'macOS'
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/v0.41.1'
file: 'neofs-cli-darwin-arm64'
target: 'neofs/neofs-cli'

- name: Chmod latest stable neofs-cli
shell: bash
run: |
Expand All @@ -84,6 +94,13 @@ runs:
run: |
echo "$NEOFS_WALLET" | base64 -d > "$GITHUB_ACTION_PATH/wallet.json"
- name: Install required package if running on macos
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install libmagic
fi
- name: Prepare venv
shell: bash
id: prepare_venv
Expand Down
5 changes: 5 additions & 0 deletions push-to-neofs.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def list_objects_in_container(endpoint: str,
f"NEOFS_CLI_PASSWORD={password} neofs-cli --rpc-endpoint {endpoint} "
f"--wallet {wallet} container list-objects --cid {cid}"
)
print(cmd)
return neofs_cli_execute(cmd)


Expand All @@ -159,7 +160,9 @@ def delete_objects(
f"NEOFS_CLI_PASSWORD={password} neofs-cli --rpc-endpoint {endpoint} "
f"--wallet {wallet} object delete --cid {cid} --oid '{oid}'"
)
print(cmd)
neofs_cli_execute(cmd)
list_objects_in_container(endpoint, wallet, password, cid)


def compile_attributes(file_path: str, content_type: str = None,
Expand Down Expand Up @@ -289,6 +292,8 @@ def push_files_to_neofs(
put_timeout,
expiration_epoch,
)

list_objects_in_container(endpoint, wallet, password, cid)

if flat_existing_objects:
delete_objects(endpoint, wallet, password, cid, flat_existing_objects)
Expand Down

0 comments on commit f29fe57

Please sign in to comment.