| # Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file | |
| # for details. All rights reserved. Use of this source code is governed by a | |
| # BSD-style license that can be found in the LICENSE file. | |
| DEPS = [ | |
| 'safe_cipd', | |
| 'recipe_engine/cipd', | |
| 'recipe_engine/file', | |
| 'recipe_engine/path', | |
| 'recipe_engine/step', | |
| ] | |
| def RunSteps(api): | |
| package_name = 'test/package' | |
| tags = {'channel': 'beta'} | |
| unique_tags = {'version': '1.2.3'} | |
| # Create a dummy file to package | |
| dummy_file = api.path.cleanup_dir / 'dummy.txt' | |
| api.file.write_text('create dummy', dummy_file, 'dummy content') | |
| pkg_def = api.cipd.PackageDefinition(package_name, api.path.cleanup_dir, | |
| 'copy') | |
| pkg_def.add_file(dummy_file) | |
| output_path = api.path.cleanup_dir / 'test.zip' | |
| # Test with no existing packages | |
| pin = api.safe_cipd.register( | |
| package_name, | |
| pkg_def, | |
| output_path, | |
| tags=tags, | |
| unique_tags=unique_tags, | |
| refs=['latest']) | |
| api.step.empty(f'uploaded pin: {pin}') | |
| assert pin is not None, 'Expected Pin, got None' | |
| def GenTests(api): | |
| yield api.test('no-existing') |