Skip to content

Commit

Permalink
Major rearchitecture (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamayoung committed May 9, 2023
1 parent e45d6b9 commit 5741462
Show file tree
Hide file tree
Showing 279 changed files with 3,899 additions and 3,028 deletions.
52 changes: 24 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,33 @@ concurrency:
group: "ci-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer

jobs:
lint:
name: Lint
runs-on: macos-12
build-test:
name: Build and Test
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3

- name: swiftlint
run: swiftlint --strict --reporter github-actions-logging
- name: Cache SPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Lint
run: swift package plugin swiftlint --strict --reporter github-actions-logging

- name: Build
run: swift build --build-tests

- name: Test
run: swift test --skip-build --parallel

codeScan:
name: Code Scan
Expand All @@ -43,30 +60,9 @@ jobs:
with:
sarif_file: results.sarif

build-test:
name: Build and Test
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache SPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build
run: swift build --build-tests

- name: Test
run: swift test --skip-build --parallel

build-documentation:
name: Build Documentation
runs-on: macos-12
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -80,4 +76,4 @@ jobs:
${{ runner.os }}-spm-
- name: Build
run: swift package generate-documentation
run: swift package generate-documentation --product PoliceDataKit
19 changes: 15 additions & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,38 @@ concurrency:
group: "documentation"
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer

jobs:
deploy:
name: Deploy
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}documentation/police-api
runs-on: macos-12
url: ${{ steps.deployment.outputs.page_url }}documentation/policedatakit
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Cache SPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build documentation
run: |
swift package --allow-writing-to-directory docs \
generate-documentation --target PoliceAPI \
generate-documentation --target PoliceDataKit \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path police-api \
--hosting-base-path police-data-kit \
--output-path docs
- name: Upload documentation
Expand Down
13 changes: 11 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@
"version" : "1.0.0"
}
},
{
"identity" : "swiftlint-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/adamayoung/swiftlint-plugin.git",
"state" : {
"revision" : "7d24ed447bda289b7770d91051e8f14c91564a18",
"version" : "0.51.0"
}
},
{
"identity" : "swiftsoup",
"kind" : "remoteSourceControl",
"location" : "https://github.com/scinfu/SwiftSoup.git",
"state" : {
"revision" : "f707b8680cddb96dc1855632340a572ef37bbb98",
"version" : "2.5.3"
"revision" : "0e96a20ffd37a515c5c963952d4335c89bed50a6",
"version" : "2.6.0"
}
}
],
Expand Down
35 changes: 25 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,49 @@
import PackageDescription

let package = Package(
name: "PoliceAPI",
name: "PoliceDataKit",

defaultLocalization: "en",

platforms: [
.macOS(.v12), .iOS(.v15), .tvOS(.v15), .watchOS(.v8)
.macOS(.v13),
.iOS(.v16),
.tvOS(.v16),
.watchOS(.v9)
],

products: [
.library(
name: "PoliceAPI",
targets: ["PoliceAPI"]
name: "PoliceDataKit",
targets: ["PoliceDataKit"]
)
],

dependencies: [
.package(url: "https://github.com/scinfu/SwiftSoup.git", .upToNextMajor(from: "2.5.3")),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.2.0")
.package(url: "https://github.com/scinfu/SwiftSoup.git", .upToNextMajor(from: "2.6.0")),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.2.0"),
.package(url: "https://github.com/adamayoung/swiftlint-plugin.git", from: "0.51.0")
],

targets: [
.target(
name: "PoliceAPI",
dependencies: ["SwiftSoup"]
name: "PoliceDataKit",
dependencies: ["SwiftSoup"],
resources: [
.process("Resources")
],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "swiftlint-plugin")
]
),
.testTarget(
name: "PoliceAPITests",
dependencies: ["PoliceAPI"],
name: "PoliceDataKitTests",
dependencies: ["PoliceDataKit"],
resources: [
.process("Resources")
],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "swiftlint-plugin")
]
)
]
Expand Down
13 changes: 8 additions & 5 deletions PoliceAPI.xctestplan → PoliceDataKit.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@
"targets" : [
{
"containerPath" : "container:",
"identifier" : "PoliceAPI",
"name" : "PoliceAPI"
"identifier" : "PoliceDataKit",
"name" : "PoliceDataKit"
}
]
}
},
"language" : "en-GB",
"region" : "GB",
"testExecutionOrdering" : "random"
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:",
"identifier" : "PoliceAPITests",
"name" : "PoliceAPITests"
"identifier" : "PoliceDataKitTests",
"name" : "PoliceDataKitTests"
}
}
],
Expand Down
42 changes: 13 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# UK Police Data
# PoliceDataKit

![CI](https://github.com/adamayoung/UKPoliceData/workflows/CI/badge.svg)
[![CI](https://github.com/adamayoung/police-data-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/adamayoung/police-data-kit/actions/workflows/ci.yml) [![Documentation](https://github.com/adamayoung/police-data-kit/actions/workflows/documentation.yml/badge.svg)](https://github.com/adamayoung/police-data-kit/actions/workflows/documentation.yml)

A Swift Package for UK Police data which provides a rich data source for information about crime and policing in England, Wales and Northern Ireland.
A Swift Package for retrieving open data about crime and policing in England, Wales and Northern Ireland.

## Requirements

Expand All @@ -12,7 +12,7 @@ A Swift Package for UK Police data which provides a rich data source for informa

### [Swift Package Manager](https://github.com/apple/swift-package-manager)

Add the PoliceAPI package as a dependency to your `Package.swift` file, and add it as a dependency to your target.
Add the PoliceDataKit package as a dependency to your `Package.swift` file, and add it as a dependency to your target.

```swift
// swift-tools-version:5.7
Expand All @@ -23,41 +23,25 @@ let package = Package(
name: "MyProject",

dependencies: [
.package(url: "https://github.com/adamayoung/police-api.git", from: "2.0.0")
.package(url: "https://github.com/adamayoung/police-data-kit.git", from: "3.0.0")
],

targets: [
.target(name: "MyProject", dependencies: [.product(name: "police-api", package: "PoliceAPI")])
.target(name: "MyProject", dependencies: [.product(name: "police-data-kit", package: "PoliceDataKit")])
]
)
```

## API Areas
### Xcode project

### Availability
Add the PoliceDataKit package to your Project's Package dependencies.

Information about availability of data.
## Documentation

### Crimes

Information about a Crimes.

### Neighbourhoods

Information about a Police Force Neighbourhoods.

### Outcomes

Information about a Crime's Outcome.

### Police Forces

Information about Police Forces and their Senior Officers.

### Stop and Searches

Information about Stop and Searches.
Documentation and examples of usage can be found at
[https://adamayoung.github.io/police-data-kit/documentation/policedatakit/](https://adamayoung.github.io/police-data-kit/documentation/policedatakit/)

## References

* [https://data.police.uk](https://data.police.uk)
* [data.police.uk](https://data.police.uk)
* [Documentation](https://adamayoung.github.io/police-data-kit/documentation/policedatakit/)
22 changes: 0 additions & 22 deletions Sources/PoliceAPI/Client/Serialiser.swift

This file was deleted.

9 changes: 0 additions & 9 deletions Sources/PoliceAPI/Extensions/URL+PoliceDataAPI.swift

This file was deleted.

8 changes: 0 additions & 8 deletions Sources/PoliceAPI/Logger+PoliceAPI.swift

This file was deleted.

4 changes: 0 additions & 4 deletions Sources/PoliceAPI/Models/Boundary.swift

This file was deleted.

0 comments on commit 5741462

Please sign in to comment.