Skip to content

Commit

Permalink
Test again
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Sep 17, 2023
1 parent 7c52878 commit 56b19d2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name: "Test downloading artifacts"
on:
workflow_dispatch:
inputs:
number_of_KAD_jobs:
number_of_jobs:
description: "Quantity of KAD jobs"
required: true
default: 3
default: 4
env:
NUMBER_OF_JOBS: ${{ github.event.inputs.number_of_jobs || 4 }}

jobs:
generate-artifacts:
Expand All @@ -20,6 +22,8 @@ jobs:
touch ./expired-d/test-1.txt
touch ./expired-d/test-2.txt
touch ./expired-d/test-3.txt
touch ./expired-d/test-4.txt
touch ./expired-d/test-5.txt
- uses: actions/upload-artifact@v3
with:
name: E_KAD_01
Expand All @@ -35,15 +39,30 @@ jobs:
name: E_KAD_03
path: |
expired-d/test-3.txt
- uses: actions/upload-artifact@v3
with:
name: E_KAD_04
path: |
expired-d/test-4.txt
- uses: actions/upload-artifact@v3
with:
name: E_KAD_05
path: |
expired-d/test-5.txt
download-artifacts:
needs: generate-artifacts
runs-on: ubuntu-latest
container: ghcr.io/filtersheroes/expired_domains_image:latest
steps:
- uses: actions/checkout@v4
- env:
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
./scripts/CI/downloadArtifacts.py "KAD" "$GITHUB_WORKSPACE/expired-d"
- uses: hawkeye116477/download-multiple-artifacts-action@v1
with:
names: |
E_KAD_01
E_KAD_02
E_KAD_03
E_KAD_04
E_KAD_05
path: expired-d
- run: |
ls -l ./expired-d
32 changes: 32 additions & 0 deletions scripts/CI/getArtifactNamesForED.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
# coding=utf-8
# pylint: disable=C0103
# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring

import os
import sys

names=[]
needed_env = 2

if sys.argv[1] == "KAD" and "NUMBER_OF_KAD_JOBS" in os.environ:
needed_env = int(os.getenv("NUMBER_OF_KAD_JOBS"))
elif sys.argv[1] == "KADhosts" and "NUMBER_OF_KADHOSTS_JOBS" in os.environ:
needed_env = int(os.getenv("NUMBER_OF_KADHOSTS_JOBS"))

for i in range(1, needed_env + 1):
if i < 10:
file_number = f"0{i}"
else:
file_number = i
names.append(f"E_{sys.argv[1]}_{file_number}")

env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a", encoding="utf-8") as env_file_c:
env_file_c.write(f"E_{sys.argv[1]}_NAMES=")
for i, file_name in enumerate(names):
if i > 0:
env_file_c.write(' ')
env_file_c.write(f"{file_name}")

0 comments on commit 56b19d2

Please sign in to comment.