diff --git a/.github/workflows/acceptable_memory_usage_test.yml b/.github/workflows/acceptable_memory_usage_test.yml index f33f84e..e7cf1d5 100644 --- a/.github/workflows/acceptable_memory_usage_test.yml +++ b/.github/workflows/acceptable_memory_usage_test.yml @@ -15,9 +15,28 @@ env: FORCE_COLOR: "1" jobs: + # This logic is based on the discussion here (and the links within): + # https://github.com/orgs/community/discussions/27128 + # + check_for_new_commits: + name: Check for commits in the last 24 hours + runs-on: ubuntu-latest + outputs: + num_new_commits: ${{ steps.count_new_commits.outputs.num_new_commits }} + steps: + - uses: actions/checkout@v6 + + - id: count_new_commits + run: echo "num_new_commits=$(git log --oneline --since '24 hours ago' | wc -l)" >> "$GITHUB_OUTPUT" + + run: name: Python ${{ matrix.python-version }} Performance Tests runs-on: ${{ matrix.os }} + + needs: check_for_new_commits + if: ${{ github.event_name == 'workflow_dispatch' || needs.check_for_new_commits.outputs.num_new_commits > 0 }} + strategy: fail-fast: false matrix: @@ -25,10 +44,10 @@ jobs: python-version: ["3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/build_and_publish_gem.yml b/.github/workflows/build_and_publish_gem.yml index b788e58..a4aad0c 100644 --- a/.github/workflows/build_and_publish_gem.yml +++ b/.github/workflows/build_and_publish_gem.yml @@ -20,7 +20,7 @@ jobs: sudo apt install -y ruby - name: Checkout code from repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Build the Ruby package run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4cb7a56..2ef8b29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,10 +25,10 @@ jobs: python-version: ["3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} @@ -48,7 +48,7 @@ jobs: run: uv run pytest --junitxml=pytest.xml - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -60,6 +60,7 @@ jobs: - name: Upload test results to Codecov if: ${{ !cancelled() }} - uses: codecov/test-results-action@v1 + uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} + report_type: test_results diff --git a/tests/acceptable_memory_usage_test.py b/tests/acceptable_memory_usage_test.py index 0f4a693..33d0725 100644 --- a/tests/acceptable_memory_usage_test.py +++ b/tests/acceptable_memory_usage_test.py @@ -16,10 +16,15 @@ def test_acceptable_memory_usage(): allele_1: HLAStandard = hla_alg.hla_standards["B"]["B*07:02:01G"] allele_2: HLAStandard = hla_alg.hla_standards["B"]["B*45:01:01G"] + # "Mush" together the two sequences by doing a bitwise or of the binary + # sequences. + exon2_bin: np.ndarray = np.array(allele_1.two) | np.array(allele_2.two) + exon3_bin: np.ndarray = np.array(allele_1.three) | np.array(allele_2.three) + expensive_sequence = HLASequence( - two=(int(s) for s in np.array(allele_1.two) | np.array(allele_2.two)), + two=tuple(int(s) for s in exon2_bin), intron=(), - three=(int(s) for s in np.array(allele_1.three) | np.array(allele_2.three)), + three=tuple(int(s) for s in exon3_bin), name="expensive_sequence", locus="B", )