Skip to content

Commit

Permalink
npm.cmd fix, more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atuchin-m committed Aug 12, 2024
1 parent 7588b6d commit dfe2bfb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,29 @@ jobs:
- name: Serialize seed
run: python seed/serialize.py seed/seed.json

- name: Generate testing_fieldtrials.json for perf tests
- name: Generate testing_fieldtrials.json (HEAD)
run: python3 seed/fieldtrials_testing_config_generator.py
--use-current-branch
--target-version 128.1.70.65
--target-channel NIGHTLY
--output fieldtrial_testing_config.json
--output-revision brave-variations-revision.txt

- name: Generate testing_fieldtrials.json (legacy seed.json)
run: python3 seed/fieldtrials_testing_config_generator.py
--target-date "2024-08-12 00:02:25 +0000"
--target-version 128.1.70.65
--target-channel NIGHTLY
--output fieldtrial_testing_config.json
--output-revision brave-variations-revision.txt

- name: Generate testing_fieldtrials.json (production-archive)
run: python3 seed/fieldtrials_testing_config_generator.py
--target-date "2024-07-18 00:02:08 +0000"
--target-version 127.1.70.1
--target-channel NIGHTLY
--output fieldtrial_testing_config.json
--output-revision brave-variations-revision.txt
--target-version 128.1.70.65 --target-channel NIGHTLY

- name: fmt seed
run: |
Expand Down
11 changes: 7 additions & 4 deletions seed/fieldtrials_testing_config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import argparse
import json
import os
import platform
import re
import serialize
import subprocess
Expand All @@ -43,7 +44,9 @@
# Now the production seed is stored in main branch.
PRODUCTION_BRANCH_MIGRATION_DATE = datetime(2024, 8, 9, tzinfo=timezone.utc)
LEGACY_SEED_PATH = 'seed/seed.json'
SEED_FOLDER = 'studies/'
SEED_FOLDER = 'studies'

NPM_EXECUTABLE = 'npm.cmd' if sys.platform == 'win32' else 'npm'

def _get_variations_revision(date: str, branch: str) -> str:
args = ['git', 'rev-list', '-n', '1', '--first-parent']
Expand Down Expand Up @@ -73,7 +76,7 @@ def _get_variations_seed(revision: str):
return legacy_seed

print('Run npm install..')
subprocess.check_output(['npm', 'install'])
subprocess.check_output([NPM_EXECUTABLE, 'install'])

tmp_dir = tempfile.mkdtemp(f'studies-{revision}')
print('temp directory to seed data:', tmp_dir)
Expand All @@ -90,8 +93,8 @@ def _get_variations_seed(revision: str):
['git', 'show', f'{revision}:{SEED_FOLDER}/{filename}'])
f.write(content)

subprocess.check_output(['npm', 'run', 'seed_tools', '--', 'create_seed',
tmp_dir, seed_path])
subprocess.check_output([NPM_EXECUTABLE, 'run', 'seed_tools', '--',
'create_seed', tmp_dir, seed_path])


seed = variations_seed_pb2.VariationsSeed()
Expand Down

0 comments on commit dfe2bfb

Please sign in to comment.