Skip to content

Commit

Permalink
Merge branch 'AcademySoftwareFoundation:main' into resolved_context_u…
Browse files Browse the repository at this point in the history
…nit_testing
  • Loading branch information
BryceGattis authored Jul 14, 2024
2 parents 234e0ea + 226bc37 commit 168665b
Show file tree
Hide file tree
Showing 18 changed files with 294 additions and 95 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
types: [opened, synchronize, reopened, labeled]

permissions:
contents: read

jobs:
run_benchmark:
name: run_benchmark
Expand All @@ -22,10 +25,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -46,7 +49,7 @@ jobs:
run: |
python ./.github/scripts/validate_benchmark.py
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: "benchmark-result-${{ matrix.python-version }}"
path: ./out
Expand All @@ -65,13 +68,13 @@ jobs:
max-parallel: 1

steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: "benchmark-result-${{ matrix.python-version }}"
path: .

- name: Checkout (release)
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: ${{ github.event_name =='release' }}
with:
ref: main
Expand All @@ -85,13 +88,13 @@ jobs:
# token: "${{ secrets.GH_ACTION_TOKEN }}"

- name: Checkout (pr)
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
if: ${{ github.event_name !='release' }}
with:
path: src

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/copyright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ on:
- '!**.md'
workflow_dispatch:

permissions:
contents: read

jobs:
main:
name: Enforce copyright notices
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/flake8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ on:
- '!src/rez/vendor/**'
- '!src/rez/backport/**'

permissions:
contents: read

jobs:
lint:
name: Run Linter
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.7

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ on:
- '!**.md'
workflow_dispatch:

permissions:
contents: read

jobs:
main:
name: ${{ matrix.os }} - ${{ matrix.python-version }} - ${{ matrix.method }}
Expand Down Expand Up @@ -76,10 +79,10 @@ jobs:
REZ_INSTALL_COMMAND: pip install --target C:\ProgramData\rez .

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
release:
types: [released]

permissions:
contents: read

jobs:
publish:
name: Publish to PyPI
Expand All @@ -11,13 +14,15 @@ jobs:
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
# Not sure if it's needed here since it's defined at the top level.
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.11

Expand All @@ -32,6 +37,6 @@ jobs:
# Note that we don't need credentials.
# We rely on https://docs.pypi.org/trusted-publishers/.
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
with:
packages-dir: dist
3 changes: 3 additions & 0 deletions .github/workflows/release-notice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
# published should cover both 'released' and 'prereleased'
- published

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -52,7 +52,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: SARIF file
path: results.sarif
Expand All @@ -61,6 +61,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
sarif_file: results.sarif
9 changes: 6 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
core:
name: Tests
Expand Down Expand Up @@ -57,10 +60,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -95,7 +98,7 @@ jobs:
_REZ_ENSURE_TEST_SHELLS: ${{ matrix.shells }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
# Run on both success and failure, but only if coverage.xml exists.
if: ${{ (success() || failure()) && ((steps.tests.outcome == 'success' || steps.tests.outcome == 'failure') && hashFiles('coverage.xml') != '') }}
with:
Expand Down
4 changes: 3 additions & 1 deletion src/rez/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ def setup_parser_common(parser):
"""Parser setup common to both rez-build and rez-release."""
from rez.build_process import get_build_process_types
from rez.build_system import get_valid_build_systems
from rez.config import config
from rez.exceptions import PackageMetadataError

process_types = get_build_process_types()
parser.add_argument(
"--process", type=str, choices=process_types, default="local",
"--process", type=str, choices=process_types,
default=config.default_build_process,
help="the build process to use (default: %(default)s).")

# add build system choices valid for this package
Expand Down
15 changes: 14 additions & 1 deletion src/rez/cli/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ def setup_parser(parser, completions=False):
parser.add_argument(
"--no-pkg-cache", action="store_true",
help="Disable package caching")
parser.add_argument(
"--pkg-cache-mode", choices=["sync", "async"],
help="If provided, override the rezconfig's package_cache_async key. "
"If 'sync', the process will block until packages are cached. "
"If 'async', the process will not block while packages are cached.")
parser.add_argument(
"--pre-command", type=str, help=SUPPRESS)
PKG_action = parser.add_argument(
Expand Down Expand Up @@ -201,6 +206,13 @@ def command(opts, parser, extra_arg_groups=None):
rule = Rule.parse_rule(rule_str)
package_filter.add_inclusion(rule)

if opts.pkg_cache_mode == "async":
package_cache_mode = True
elif opts.pkg_cache_mode == "sync":
package_cache_mode = False
else:
package_cache_mode = None

# perform the resolve
context = ResolvedContext(
package_requests=request,
Expand All @@ -215,7 +227,8 @@ def command(opts, parser, extra_arg_groups=None):
caching=(not opts.no_cache),
suppress_passive=opts.no_passive,
print_stats=opts.stats,
package_caching=(not opts.no_pkg_cache)
package_caching=(not opts.no_pkg_cache),
package_cache_async=package_cache_mode,
)

success = (context.status == ResolverStatus.solved)
Expand Down
2 changes: 2 additions & 0 deletions src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def _parse_env_var(self, value):
"release_packages_path": Str,
"dot_image_format": Str,
"build_directory": Str,
"default_build_process": Str,
"documentation_url": Str,
"suite_visibility": SuiteVisibility_,
"rez_tools_visibility": RezToolsVisibility_,
Expand Down Expand Up @@ -453,6 +454,7 @@ def _parse_env_var(self, value):
"package_cache_during_build": Bool,
"package_cache_local": Bool,
"package_cache_same_device": Bool,
"package_cache_async": Bool,
"color_enabled": ForceOrBool,
"resolve_caching": Bool,
"cache_package_files": Bool,
Expand Down
Loading

0 comments on commit 168665b

Please sign in to comment.