Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ runs:
with:
swift-version: ${{ inputs.swift }}
- uses: irgaly/setup-mint@v1
- if: contains(inputs.os, 'macos')
- name: "Xcode Cache"
if: contains(inputs.os, 'macos')
uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
# There is no `Xcode/DerivedData`; use `.build` instead.
deriveddata-directory: .build
restore-keys: |
xcode-cache-deriveddata-${{ github.workflow }}-
- name: "Swift Package Manager Cache"
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-

# Hint: Use Composite Actions
# - https://stackoverflow.com/a/75735736/9801139
Expand Down
37 changes: 32 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,43 @@ force:
Submodule: force
git submodule update --recursive --remote
git add $@
git commit -m "Update $$(git submodule status Submodule/github/rest-api-description)" || true
git commit -m "[Make] Pull $$(git submodule status Submodule/github/rest-api-description)" || true
echo "::notice:: make $@"

OPENAPI_FILES := $(addsuffix /openapi.yml, $(SUBDIRS))
Sources/%/openapi.yml: Submodule
%/openapi.yml: Submodule
ln -sf ../../Submodule/github/rest-api-description/descriptions/api.github.com/api.github.com.yaml $@
git add $@
git commit -m "Relink $@" || true

.PHONY: install
install: $(OPENAPI_FILES)
SWIFT_FILES := $(addsuffix /Client.swift, $(SUBDIRS))
%.swift: $(OPENAPI_FILES)
mint run apple/swift-openapi-generator generate $(@D)/openapi.yml \
--config $(@D)/openapi-generator-config.yml \
--output-directory $(@D)
git add $@ $(@D)/Types.swift

install-files: $(SWIFT_FILES)
git commit -m "[Make] Re-link openapi.yml & re-gen swift files." || true
echo "::notice:: make $@"

#XCFrameworks:
# mint run giginet/Scipio create . \
# --embed-debug-symbols \
# --support-simulators
# echo "::notice:: make $@"
#
#XCFRAMEWORKS := $(wildcard XCFrameworks/*.xcframework)
#ZIP_FILES := $(XCFRAMEWORKS:%.xcframework=%.zip)
#%.zip: %.xcframework
# zip -r "$@" "$^"
# rm -rf "$^"
# git add "$@"
#
#install-zips: XCFrameworks $(ZIP_FILES)
# git commit -m "[Make] Re-gen framework zips" || true
# echo "::notice:: make $@"

install: install-files

.build/docs: ## Need env GITHUB_PAGES is created as 'true'
swift package --allow-writing-to-directory $@ generate-documentation \
Expand Down
54 changes: 0 additions & 54 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ enum GitHubRestAPIOpenAPITag: String, CaseIterable {
resources: [
.copy("openapi-generator-config.yml"),
.copy("openapi.yml"),
],
plugins: [
.plugin(name: "OpenAPIGenerator", package: "swift-openapi-generator"),
]
)
}
Expand All @@ -91,7 +88,6 @@ let package = Package(
platforms: [.macOS(.v10_15)],
products: GitHubRestAPIOpenAPITag.allCases.map(\.library),
dependencies: [
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
],
Expand All @@ -100,10 +96,10 @@ let package = Package(
]
)

let isBuildDocC = ProcessInfo.processInfo.environment["GITHUB_PAGES"] == "true"
let isBuildingDocC = ProcessInfo.processInfo.environment["GITHUB_PAGES"] == "true"

// swift-docs is not needed for package users
if isBuildDocC {
if isBuildingDocC {
package.dependencies += [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
]
Expand Down
Loading