diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bfc4b4c..9f48cb9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "develop" labels: - "dependencies" - "ci" @@ -12,5 +13,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "develop" + open-pull-requests-limit: 10 labels: - "dependencies" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a22df1..f70f28f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: pull_request: - branches: [main, 1.0-maintenance, 2.0-development] + branches: [main, develop] push: - branches: [main] + branches: [main, develop] permissions: contents: read diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 0d46996..28bb56b 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -2,7 +2,7 @@ name: Commit Lint on: pull_request: - branches: [main, 1.0-maintenance] + branches: [main, develop] permissions: contents: read @@ -30,9 +30,8 @@ jobs: "chore", "docs", "test", "style", "ci", "perf" ]], "scope-enum": [1, "always", [ - "core", "helpers", "deps", "release", "ci", - "version", "hmac", "docs", "tests", "examples", - "async", "statcalc" + "core", "helpers", "deps", "release", "ci", + "version", "hmac", "docs", "tests", "examples" ]], "subject-max-length": [1, "always", 100], "header-max-length": [0, "always"], diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index a767e88..91d0463 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -2,9 +2,9 @@ name: Integration Tests on: pull_request: - branches: [main, 1.0-maintenance] + branches: [main, develop] push: - branches: [main] + branches: [main, develop] workflow_dispatch: permissions: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6c9478..0db7e3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ jobs: release: name: Semantic Release runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' concurrency: group: ${{ github.workflow }}-release-${{ github.ref_name }} @@ -70,6 +71,7 @@ jobs: # Publish the package to PyPI pypi-publish: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' needs: - release permissions: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 36aee02..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test - -on: - pull_request: - push: - branches: - - main - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - - name: Setup uv - uses: astral-sh/setup-uv@v7 - - - name: Sync dependencies - run: uv sync --group dev --group docs - - - name: Run unit tests - run: uv run pytest -q - - - name: Build docs - run: uv run mkdocs build diff --git a/src/swgoh_comlink/helpers/_arena.py b/src/swgoh_comlink/helpers/_arena.py index ac11b3b..e2e52d4 100644 --- a/src/swgoh_comlink/helpers/_arena.py +++ b/src/swgoh_comlink/helpers/_arena.py @@ -52,6 +52,7 @@ def get_arena_payout(offset: int, fleet: bool = False) -> datetime: else: payout = payout.replace(hour=18, minute=0, second=0, microsecond=0) payout = payout - timedelta(minutes=(offset + local_offset)) - if payout < datetime.now(): + # Loop until payout time is in the future in case payout time is adjusted to a past time + while payout < datetime.now(): payout = payout + timedelta(days=1) return payout diff --git a/tests/integration/test_hmac.py b/tests/integration/test_hmac.py index edb8b78..8d14154 100644 --- a/tests/integration/test_hmac.py +++ b/tests/integration/test_hmac.py @@ -14,6 +14,7 @@ COMLINK_HMAC_URL, HMAC_ACCESS_KEY, HMAC_SECRET_KEY, + TEST_ALLYCODE, ) pytestmark = pytest.mark.integration @@ -48,14 +49,24 @@ def test_hmac_sync_player_request_succeeds(comlink_hmac): @hmac_configured def test_hmac_no_key_rejected(): - """Sync client without HMAC keys is rejected by the protected endpoint.""" + """Sync client without HMAC keys is rejected by the protected endpoint. + + Uses a POST endpoint (`playerArena`) because the Comlink HMAC service + only enforces HMAC on POST; GET endpoints like `/enums` are + unauthenticated. + """ with SwgohComlink(url=COMLINK_HMAC_URL) as client, pytest.raises(SwgohComlinkException): - client.get_enums() + client.get_player_arena(allycode=TEST_ALLYCODE, player_details_only=True) @hmac_configured def test_hmac_wrong_key_rejected(): - """Sync client with wrong secret key is rejected by the protected endpoint.""" + """Sync client with wrong secret key is rejected by the protected endpoint. + + Uses a POST endpoint (`playerArena`) because the Comlink HMAC service + only enforces HMAC on POST; GET endpoints like `/enums` are + unauthenticated. + """ with ( SwgohComlink( url=COMLINK_HMAC_URL, @@ -64,7 +75,7 @@ def test_hmac_wrong_key_rejected(): ) as client, pytest.raises(SwgohComlinkException), ): - client.get_enums() + client.get_player_arena(allycode=TEST_ALLYCODE, player_details_only=True) # ── Async: valid HMAC ─────────────────────────────────────────────────── @@ -94,23 +105,33 @@ async def test_hmac_async_player_request_succeeds(async_comlink_hmac): @hmac_configured @pytest.mark.asyncio async def test_hmac_no_key_async_rejected(): - """Async client without HMAC keys is rejected by the protected endpoint.""" + """Async client without HMAC keys is rejected by the protected endpoint. + + Uses a POST endpoint (`playerArena`) because the Comlink HMAC service + only enforces HMAC on POST; GET endpoints like `/enums` are + unauthenticated. + """ async with SwgohComlinkAsync(url=COMLINK_HMAC_URL) as client: with pytest.raises(SwgohComlinkException): - await client.get_enums() + await client.get_player_arena(allycode=TEST_ALLYCODE, player_details_only=True) @hmac_configured @pytest.mark.asyncio async def test_hmac_wrong_key_async_rejected(): - """Async client with wrong secret key is rejected by the protected endpoint.""" + """Async client with wrong secret key is rejected by the protected endpoint. + + Uses a POST endpoint (`playerArena`) because the Comlink HMAC service + only enforces HMAC on POST; GET endpoints like `/enums` are + unauthenticated. + """ async with SwgohComlinkAsync( url=COMLINK_HMAC_URL, access_key=HMAC_ACCESS_KEY, secret_key="wrong_secret_key", ) as client: with pytest.raises(SwgohComlinkException): - await client.get_enums() + await client.get_player_arena(allycode=TEST_ALLYCODE, player_details_only=True) # ── HMAC header verification ────────────────────────────────────────────