Skip to content

Commit

Permalink
Merge pull request #54 from SwiftPackageIndex/renamed-dependency-check-2
Browse files Browse the repository at this point in the history
CheckDependencies2 → CheckDependencies
  • Loading branch information
finestructure committed Jan 5, 2024
2 parents 4cd97c1 + 4270595 commit bdc08ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ name: CI
on:
workflow_dispatch:
push:
# branches: [ main ]
pull_request:
branches: [ main ]

env:
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPI_API_TOKEN: ${{ secrets.SPI_API_TOKEN }}

jobs:
test-validator-Linux:
Expand All @@ -41,6 +39,9 @@ jobs:
run: |
swift build
- name: Install curl
run: apt-get update && apt-get install -y curl

- name: Check redirects
run: ./check-redirects.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import AsyncHTTPClient
import CanonicalPackageURL


public struct CheckDependencies2: AsyncParsableCommand {
public struct CheckDependencies: AsyncParsableCommand {
@Option(name: .long)
var apiBaseURL: String = "https://swiftpackageindex.com"

Expand All @@ -29,6 +29,9 @@ public struct CheckDependencies2: AsyncParsableCommand {
@Option(name: .shortAndLong)
var limit: Int = .max

@Option(name: .shortAndLong)
var maxCheck: Int = .max

@Option(name: .shortAndLong, help: "save changes to output file")
var output: String?

Expand Down Expand Up @@ -58,6 +61,7 @@ public struct CheckDependencies2: AsyncParsableCommand {
var newPackages = UniqueCanonicalPackageURLs()
for (idx, dep) in missing
.sorted(by: { $0.packageURL.absoluteString < $1.packageURL.absoluteString })
.prefix(maxCheck)
.enumerated() {
if idx % 10 == 0 {
print("Progress:", idx, "/", missing.count)
Expand Down Expand Up @@ -124,7 +128,7 @@ public struct CheckDependencies2: AsyncParsableCommand {
}


extension CheckDependencies2 {
extension CheckDependencies {
var inputSource: InputSource {
switch (input, packageUrls.count) {
case (.some(let fname), 0):
Expand Down
2 changes: 1 addition & 1 deletion Sources/ValidatorCore/Commands/Validator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import ArgumentParser
public struct Validator: AsyncParsableCommand {
public static var configuration = CommandConfiguration(
abstract: "SPI Validator",
subcommands: [CheckDependencies2.self,
subcommands: [CheckDependencies.self,
CheckRedirects.self,
MergeLists.self,
ApplyDenyList.self,
Expand Down
2 changes: 1 addition & 1 deletion Tests/ValidatorTests/CheckDependencies2Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import NIO


final class CheckDependencies2Tests: XCTestCase {
var check = CheckDependencies2()
var check = CheckDependencies()

override func setUp() {
super.setUp()
Expand Down
5 changes: 4 additions & 1 deletion check-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ curl -s https://raw.githubusercontent.com/SwiftPackageIndex/PackageList/main/pac
echo "..."
echo

$validator check-dependencies --use-package-list -o packages.json -l 10 --chunk 1 --number-of-chunks 3
$validator check-dependencies \
--spi-api-token "$SPI_API_TOKEN" \
-i packages.json -o packages.json \
--max-check 1

0 comments on commit bdc08ad

Please sign in to comment.