Few fixes and improvements to the library, plus Github Actions setup (#31)
CI / Build and test (push) Canceled after 0s
Documentation / Build documentation (push) Canceled after 0s
Documentation / Deploy to GitHub Pages (push) Canceled after 0s
CI / Build and test (push) Canceled after 0s
Documentation / Build documentation (push) Canceled after 0s
Documentation / Deploy to GitHub Pages (push) Canceled after 0s
This PR contains the work done to fix a cancellation-mapping bug in `AmiiboLiveClient`, bring the client under offline test coverage, add the conformances SwiftUI and persistence need, and moves CI and documentation publishing to GitHub Actions. All public API changes are additive.
### Fix
- `AmiiboLiveClient` reported an early task cancellation as `.unknown("CancellationError()")`. The OpenAPI runtime wraps every error in `ClientError`, so the `CancellationError` check never matched; it now also checks the wrapped error and throws `.cancelled`.
### Tests
- `ThrowingTransport` and `StubTransport` test doubles let the live client run offline. New tests cover error mapping, HTTP status → error mapping, `oneOf` object-vs-list decoding, `"amiibo": null`, sorting, filter → query encoding, `Platform`/`Release` mapping, and the date transcoder.
- Models gained `package` memberwise initializers so tests can build real fixtures without `@testable`. These are not public API.
- The test target now depends on `OpenAPIRuntime` and `HTTPTypes` (both already in the dependency graph).
### API
- Models are `Codable` and `Identifiable` (`Amiibo.id` is its `identifier`; the key/name models use `key`).
- Filters are `Hashable`.
### Documentation
- Doc comments trimmed library-wide; one repeated `- Throws:` sentence appeared 24 times. `Library.md` and the README tightened to match.
### CI and docs publishing
- `ci.yml`: build and offline tests on PRs and pushes to `main`.
- `live-tests.yml`: weekly and on-demand run against the live API.
- `docs.yml`: builds DocC on PRs, deploys to GitHub Pages on `main`. Pinned to Xcode 26 because swift-docc-plugin 1.5.0 fails to launch its tools under Xcode 27.
- The generated `docs/` folder (327 files) is removed from the repository and ignored.
Reviewed-on: #31
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #31.
This commit is contained in:
1 parent
44bfaca553
commit
13b9c74a38
361 files changed
+1395
-863
No files matched your search
@@ -0,0 +1,57 @@
|
||||
# ===----------------------------------------------------------------------===
|
||||
#
|
||||
# This source file is part of the Amiibo Service open source project
|
||||
#
|
||||
# Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
# Licensed under Apache license v2.0
|
||||
#
|
||||
# See LICENSE for license information
|
||||
# See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# ===----------------------------------------------------------------------===
|
||||
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Build and test
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Select Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
- name: Show toolchain
|
||||
run: swift --version
|
||||
|
||||
- name: Cache build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .build
|
||||
key: spm-${{ runner.os }}-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: spm-${{ runner.os }}-
|
||||
|
||||
- name: Build
|
||||
run: make lib-build
|
||||
|
||||
- name: Test
|
||||
run: make lib-test
|
||||
@@ -0,0 +1,77 @@
|
||||
# ===----------------------------------------------------------------------===
|
||||
#
|
||||
# This source file is part of the Amiibo Service open source project
|
||||
#
|
||||
# Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
# Licensed under Apache license v2.0
|
||||
#
|
||||
# See LICENSE for license information
|
||||
# See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# ===----------------------------------------------------------------------===
|
||||
|
||||
name: Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: docs-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build documentation
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Pinned: swift-docc-plugin 1.5.0 fails to launch its tools under Xcode 27 ("Bad CPU type in executable").
|
||||
- name: Select Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '26'
|
||||
|
||||
- name: Show toolchain
|
||||
run: swift --version
|
||||
|
||||
- name: Cache build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .build
|
||||
key: spm-${{ runner.os }}-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: spm-${{ runner.os }}-
|
||||
|
||||
- name: Generate
|
||||
run: make doc-generate-github
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs
|
||||
|
||||
deploy:
|
||||
name: Deploy to GitHub Pages
|
||||
if: github.event_name != 'pull_request'
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deploy.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy
|
||||
id: deploy
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -0,0 +1,52 @@
|
||||
# ===----------------------------------------------------------------------===
|
||||
#
|
||||
# This source file is part of the Amiibo Service open source project
|
||||
#
|
||||
# Copyright (c) 2026 Röck+Cöde VoF. and the Amiibo Service project authors
|
||||
# Licensed under Apache license v2.0
|
||||
#
|
||||
# See LICENSE for license information
|
||||
# See CONTRIBUTORS for the list of Amiibo Service project authors
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# ===----------------------------------------------------------------------===
|
||||
|
||||
name: Live tests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every Monday at 06:00 UTC.
|
||||
- cron: '0 6 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test against the live service
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Select Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
- name: Show toolchain
|
||||
run: swift --version
|
||||
|
||||
- name: Cache build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .build
|
||||
key: spm-${{ runner.os }}-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: spm-${{ runner.os }}-
|
||||
|
||||
- name: Test
|
||||
run: make lib-test
|
||||
env:
|
||||
AMIIBO_LIVE_TESTS: '1'
|
||||
Reference in new issue
Block a user