diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 41a3888..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,33 +0,0 @@ - - -# *Name of the PR* - -## :recycle: Current situation & Problem -*Describe the current situation (if possible with and exemplary (or real) code snippet and/or where this is used)* - -## :bulb: Proposed solution -*Describe the solution and how this affects the project and internal structure* - -## :gear: Release Notes -*Add a short summary of the feature as well as possible migration guides if this is a breaking change so this section can be added to the release notes.* -*Include code snippets that provide examples of the feature implemented if it appends or changes the public interface.* - -## :heavy_plus_sign: Additional Information -*Provide some additional information if possible* - -### Related PRs -*Reference the related PRs* - -### Testing -*Are there tests included? If yes, which situations are tested and which corner cases are missing?* - -### Reviewer Nudging -*Where should the reviewer start, where is a good entry point?* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index e82d0cc..0000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# This source file is part of the Apodini Template open source project -# -# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -branches: [release] -name-template: '$NEXT_PATCH_VERSION' -tag-template: '$NEXT_PATCH_VERSION' -categories: - - title: 'Semantic Version Major' - labels: - - 'needs version bump' - - title: 'Semantic Version Minor' - labels: - - 'feature' - - 'enhancement' - - title: 'Other Changes' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - 'documentation' -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' -template: | - ## Changes - - $CHANGES \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml deleted file mode 100644 index 70606d9..0000000 --- a/.github/workflows/build-and-test.yml +++ /dev/null @@ -1,116 +0,0 @@ -# -# This source file is part of the Apodini open source project -# -# SPDX-FileCopyrightText: 2019-2021 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -name: Build and Test - -on: - push: - branches: - - develop - - release - pull_request: - branches: - - develop - - release - workflow_dispatch: - -jobs: -# builddocs: -# name: Build Docs -# runs-on: macos-12 -# steps: -# - uses: actions/checkout@v2 -# - uses: maxim-lobanov/setup-xcode@v1.2.3 -# with: -# xcode-version: latest -# - name: Check Xcode version -# run: xcodebuild -version -# - name: Check Swift version -# run: swift --version -# - name: Test Generating Docs -# run: | -# xcodebuild docbuild -scheme Apodini-Package -destination platform=macOS,arch=x86_64 -derivedDataPath ./.xcodebuild -# cp -r $(find ./.xcodebuild -type d -name 'Apodini.doccarchive') ./Apodini.doccarchive -# echo "The DocC archive can be found at ./Apodini.doccarchive" -# macos: -# name: macOS ${{ matrix.configuration }} -# runs-on: macos-12 -# strategy: -# fail-fast: false -# matrix: -# configuration: [debug, release, release_testing] -# steps: -# - uses: actions/checkout@v2 -# - uses: maxim-lobanov/setup-xcode@v1.2.3 -# with: -# xcode-version: latest -# - uses: actions/cache@v2 -# with: -# path: .build -# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} -# - name: Check Xcode version -# run: xcodebuild -version -# - name: Check Swift version -# run: swift --version -# - name: Release Build # Ensuring release build runs successfully without -enable-testing flag -# if: matrix.configuration == 'release' -# run: swift build -c release -# - name: Release Build & Test -# if: matrix.configuration == 'release_testing' -# run: swift test -c release -Xswiftc -enable-testing -Xswiftc -DRELEASE_TESTING -# env: -# ENABLE_DEPLOYMENT_PROVIDER_TESTS: YES -# - name: Debug Build & Test -# if: matrix.configuration == 'debug' -# run: swift test -c debug --enable-code-coverage -Xswiftc -DCOVERAGE -# env: -# ENABLE_DEPLOYMENT_PROVIDER_TESTS: YES -# - name: Convert coverage report -# if: matrix.configuration == 'debug' -# run: xcrun llvm-cov export -format="lcov" .build/debug/ApodiniPackageTests.xctest/Contents/MacOS/ApodiniPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov -# - name: Upload coverage to Codecov -# uses: codecov/codecov-action@v1 - linux: - name: Linux ${{ matrix.linux }} ${{ matrix.configuration }} - container: - image: swiftlang/swift:nightly-5.5-${{ matrix.linux }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - linux: [bionic, focal, amazonlinux2, centos8] - configuration: [debug, release, release_testing] - steps: - - uses: actions/checkout@v2 - - name: Install libsqlite3, lsof, zsh and libavahi-compat-libdnssd-dev - if: ${{ !(startsWith( matrix.linux, 'centos' ) || startsWith( matrix.linux, 'amazonlinux' )) }} - run: apt-get update && apt-get install -y --no-install-recommends libsqlite3-dev lsof zsh libavahi-compat-libdnssd-dev - - name: Install libsqlite3 and avahi - if: startsWith( matrix.linux, 'amazonlinux' ) - run: yum update -y && yum install -y sqlite-devel avahi avahi-compat-libdns_sd avahi-compat-libdns_sd-devel - - name: Install libsqlite3 - if: startsWith( matrix.linux, 'centos' ) - run: yum update -y --nobest && yum install -y sqlite-devel - - name: Install avahi - if: startsWith( matrix.linux, 'centos' ) - run: dnf update -y && dnf --enablerepo=powertools -y install avahi-compat-libdns_sd avahi-compat-libdns_sd-devel - - uses: actions/cache@v2 - with: - path: .build - key: ${{ runner.os }}-${{matrix.linux}}-${{matrix.configuration}}-spm2-${{ hashFiles('Package.resolved') }} - - name: Check Swift version - run: swift --version - - name: Release Build # Ensuring release build runs successfully without -enable-testing flag - if: matrix.configuration == 'release' - run: swift build -c release - - name: Release Build & Test - if: matrix.configuration == 'release_testing' - run: swift test -c release -Xswiftc -enable-testing -Xswiftc -DRELEASE_TESTING - - name: Debug Build & Test - if: matrix.configuration == 'debug' - run: swift test -c debug diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..18bc56d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +# +# This source file is part of the Apodini open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Build + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + build_and_test: + name: Build and Test + uses: Apodini/.github/.github/workflows/build-and-test.yml@v1 + with: + packagename: ApodiniIoTDeploymentProvider + aptgetdependencies: libavahi-compat-libdnssd-dev + yumdependencies: avahi avahi-compat-libdns_sd avahi-compat-libdns_sd-devel diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..0cbc0a1 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,28 @@ +# +# This source file is part of the Apodini open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Pull Request + +on: + pull_request: + workflow_dispatch: + +jobs: + build_and_test: + name: Build and Test + uses: Apodini/.github/.github/workflows/build-and-test.yml@v1 + with: + packagename: ApodiniIoTDeploymentProvider + aptgetdependencies: libavahi-compat-libdnssd-dev + yumdependencies: avahi avahi-compat-libdns_sd avahi-compat-libdns_sd-devel + reuse_action: + name: REUSE Compliance Check + uses: Apodini/.github/.github/workflows/reuse.yml@v1 + swiftlint: + name: SwiftLint + uses: Apodini/.github/.github/workflows/swiftlint.yml@v1 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 6ff2a20..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,22 +0,0 @@ -# -# This source file is part of the Apodini Template open source project -# -# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -name: Release Drafter - -on: - push: - branches: - - develop - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dab9e42..f98d054 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,21 @@ -# -# This source file is part of the Apodini Template open source project -# +# +# This source file is part of the Apodini open source project +# # SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# +# # SPDX-License-Identifier: MIT -# +# -name: Create Release +name: Release on: - push: - tags: - - '*.*.*' + release: + types: [published] + workflow_dispatch: jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Create GitHub Release - uses: softprops/action-gh-release@v0.1.5 - env: - GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + docs: + name: Generate Docs + uses: Apodini/.github/.github/workflows/docs.yml@v1 + with: + targetname: IoTDeploymentProvider diff --git a/.github/workflows/reuseaction.yml b/.github/workflows/reuseaction.yml deleted file mode 100644 index a16ddd3..0000000 --- a/.github/workflows/reuseaction.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# This source file is part of the Apodini Template open source project -# -# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -name: REUSE Compliance Check - -on: - push: - branches: - - develop - pull_request: - workflow_dispatch: - -jobs: - reuse: - name: REUSE Compliance Check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v1 diff --git a/.github/workflows/spm-update.yml b/.github/workflows/spm-update.yml deleted file mode 100644 index 896bfa3..0000000 --- a/.github/workflows/spm-update.yml +++ /dev/null @@ -1,40 +0,0 @@ -# -# This source file is part of the Apodini Template open source project -# -# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -name: Swift Package Update - -on: - schedule: - - cron: '0 0 1 * *' - workflow_dispatch: - -jobs: - createPR: - name: Create Pull Request - container: - image: swiftlang/swift:nightly-5.5-focal - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Check Swift version - run: swift --version - - name: Update Swift Packages - run: swift package update - - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.ACCESS_TOKEN }} - commit-message: Update dependencies - title: Update dependencies - body: Update the Swift Package dependencies. - delete-branch: true - base: develop - branch: bots/update-dependencies - assignees: ApodiniBot - committer: ApodiniBot - author: ApodiniBot - reviewers: PSchmiedmayer diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml deleted file mode 100644 index eace4d1..0000000 --- a/.github/workflows/swiftlint.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# This source file is part of the Apodini Template open source project -# -# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) -# -# SPDX-License-Identifier: MIT -# - -name: SwiftLint - -on: - push: - branches: - - develop - - release - pull_request: - branches: - - develop - - release - workflow_dispatch: - -jobs: - swiftlint: - name: SwiftLint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.2.1 - with: - args: --strict - env: - DIFF_BASE: ${{ github.base_ref }} diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..481bc51 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,21 @@ +# +# This source file is part of the Apodini open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Update + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: + +jobs: + spm_update: + name: Swift Package Update + uses: Apodini/.github/.github/workflows/spm-update.yml@v1 + secrets: + token: ${{ secrets.ACCESS_TOKEN }} diff --git a/Package.resolved b/Package.resolved index be1bdd1..3fb14ff 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,8 +15,17 @@ "repositoryURL": "https://github.com/Apodini/Apodini.git", "state": { "branch": null, - "revision": "b0d2936496168e2635122534451a8537b2679668", - "version": "0.6.2" + "revision": "b77bbbd0e5645fce4cd092cda685be5c1ef8a992", + "version": "0.9.2" + } + }, + { + "package": "ApodiniDocumentExport", + "repositoryURL": "https://github.com/Apodini/ApodiniDocumentExport.git", + "state": { + "branch": null, + "revision": "0a3fe4195f011057ad2cd5150c9091f2a17c2ec1", + "version": "0.1.1" } }, { @@ -24,8 +33,8 @@ "repositoryURL": "https://github.com/Apodini/ApodiniMigrator.git", "state": { "branch": null, - "revision": "c2bb44275a82ec61de70e114d07eafc803d73f41", - "version": "0.1.4" + "revision": "10671191ddd8a19a61ac6cae06060d259dbfe9ce", + "version": "0.3.0" } }, { @@ -33,8 +42,8 @@ "repositoryURL": "https://github.com/Apodini/ApodiniTypeInformation.git", "state": { "branch": null, - "revision": "95109a6f3cf93a828d1b0adf2cdc299e31fe5e87", - "version": "0.2.1" + "revision": "40247bedd5153b7641e95a11bd826b16a15fd12e", + "version": "0.3.6" } }, { @@ -51,8 +60,8 @@ "repositoryURL": "https://github.com/swift-server/async-http-client.git", "state": { "branch": null, - "revision": "1081b0b0541f535ca088acdb56f5ca5598bc6247", - "version": "1.6.3" + "revision": "7a4dfe026f6ee0f8ad741b58df74c60af296365d", + "version": "1.9.0" } }, { @@ -60,8 +69,8 @@ "repositoryURL": "https://github.com/vapor/async-kit.git", "state": { "branch": null, - "revision": "3b1e7e9069a62295151c6c1609050cd38a0a7af5", - "version": "1.11.0" + "revision": "e2f741640364c1d271405da637029ea6a33f754e", + "version": "1.11.1" } }, { @@ -78,8 +87,8 @@ "repositoryURL": "https://github.com/vapor/fluent-kit.git", "state": { "branch": null, - "revision": "2f1af22f4d495bc6f35365e537c4bb5eb60c5f17", - "version": "1.18.0" + "revision": "63c13b1fcc5266d35df676a8e75bbb602497f12b", + "version": "1.23.4" } }, { @@ -91,13 +100,31 @@ "version": "4.1.0" } }, + { + "package": "GraphQL", + "repositoryURL": "https://github.com/GraphQLSwift/GraphQL", + "state": { + "branch": null, + "revision": "283cc4de56b994a00b2724328221b7a1bc846ddc", + "version": "2.2.1" + } + }, + { + "package": "grpc-swift", + "repositoryURL": "https://github.com/grpc/grpc-swift.git", + "state": { + "branch": null, + "revision": "593fe0fe931f7e838969243cd137be48e8055b1d", + "version": "1.7.3" + } + }, { "package": "jmespath.swift", "repositoryURL": "https://github.com/adam-fowler/jmespath.swift.git", "state": { "branch": null, - "revision": "4a166ea71f0d9e9cc3523fc3dee516080a4c36a0", - "version": "1.0.0" + "revision": "4513d319c4aaa6c3b2ac18e1e6566a803515ad91", + "version": "1.0.2" } }, { @@ -105,8 +132,8 @@ "repositoryURL": "https://github.com/vapor/jwt-kit.git", "state": { "branch": null, - "revision": "1822bb0abf0a31a4b5078ec19061c548835253b5", - "version": "4.3.0" + "revision": "5f9c44d4c196cc06c3fc601f279169f121d6f62d", + "version": "4.4.0" } }, { @@ -114,8 +141,8 @@ "repositoryURL": "https://github.com/Apodini/MetadataSystem.git", "state": { "branch": null, - "revision": "06cac46a958fdf700054f12f682b5c8f27577c9f", - "version": "0.1.1" + "revision": "f655813f1953af8d3aaac432dad35f394e7bdf75", + "version": "0.1.6" } }, { @@ -132,8 +159,17 @@ "repositoryURL": "https://github.com/mattpolzin/OpenAPIKit.git", "state": { "branch": null, - "revision": "4986552e76c331a99770428bd2be77ad76068c08", - "version": "2.4.0" + "revision": "328d11996ccc43205bd861535021d8c22168a08a", + "version": "2.5.0" + } + }, + { + "package": "opentelemetry-swift", + "repositoryURL": "https://github.com/slashmo/opentelemetry-swift.git", + "state": { + "branch": null, + "revision": "6d3cc7c896b4dd426494ea59a5b67c9425b593cc", + "version": "0.2.0" } }, { @@ -168,8 +204,8 @@ "repositoryURL": "https://github.com/soto-project/soto.git", "state": { "branch": null, - "revision": "cd90cff19b892078c17baae08270707e3fc1590c", - "version": "5.11.0" + "revision": "b98994beabdced18cbedbe50e947e6f2c8e0d602", + "version": "5.12.1" } }, { @@ -177,8 +213,8 @@ "repositoryURL": "https://github.com/soto-project/soto-core.git", "state": { "branch": null, - "revision": "988f0d906f5c76cf93c88fa5820f7c72e4b8fd98", - "version": "5.8.0" + "revision": "3079d17f2576cff5f2a3f68865629af455c673d1", + "version": "5.9.3" } }, { @@ -186,8 +222,8 @@ "repositoryURL": "https://github.com/soto-project/soto-s3-file-transfer", "state": { "branch": null, - "revision": "6a35d736753d46f5dc76712855428de412967d94", - "version": "0.4.0" + "revision": "74899d6e9b95cfb9543993ece6aa56796cf6ba80", + "version": "0.4.2" } }, { @@ -204,8 +240,8 @@ "repositoryURL": "https://github.com/vapor/sql-kit.git", "state": { "branch": null, - "revision": "9cc30f8cef132e91a07e36005612b37f918731fc", - "version": "3.16.0" + "revision": "afc74d888649f2b2a2f8cc7963be5eb179409610", + "version": "3.17.0" } }, { @@ -235,6 +271,15 @@ "version": "1.3.1" } }, + { + "package": "swift-algorithms", + "repositoryURL": "https://github.com/apple/swift-algorithms", + "state": { + "branch": null, + "revision": "b14b7f4c528c942f121c8b860b9410b2bf57825e", + "version": "1.0.0" + } + }, { "package": "swift-argument-parser", "repositoryURL": "https://github.com/apple/swift-argument-parser", @@ -244,6 +289,24 @@ "version": "0.4.4" } }, + { + "package": "swift-aws-lambda-runtime", + "repositoryURL": "https://github.com/swift-server/swift-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "699ada1724459582303c15aae64fa12ca4d33809", + "version": "0.5.2" + } + }, + { + "package": "swift-backtrace", + "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", + "state": { + "branch": null, + "revision": "d3e04a9d4b3833363fb6192065b763310b156d54", + "version": "1.3.1" + } + }, { "package": "swift-collections", "repositoryURL": "https://github.com/apple/swift-collections", @@ -258,8 +321,26 @@ "repositoryURL": "https://github.com/apple/swift-crypto.git", "state": { "branch": null, - "revision": "9c53b7a758bb849a7df1bd2314395f5f0c14306f", - "version": "2.0.3" + "revision": "067254c79435de759aeef4a6a03e43d087d61312", + "version": "2.0.5" + } + }, + { + "package": "swift-distributed-tracing", + "repositoryURL": "https://github.com/apple/swift-distributed-tracing.git", + "state": { + "branch": null, + "revision": "7a89c904d80fd2dc7c6071806f38d5d0b2d5a1b5", + "version": "0.2.0" + } + }, + { + "package": "swift-distributed-tracing-baggage", + "repositoryURL": "https://github.com/apple/swift-distributed-tracing-baggage.git", + "state": { + "branch": null, + "revision": "c8457ce61adc6a3b9e6223ca147f5196f99e22cc", + "version": "0.2.3" } }, { @@ -294,8 +375,8 @@ "repositoryURL": "https://github.com/apple/swift-nio.git", "state": { "branch": null, - "revision": "6aa9347d9bc5bbfe6a84983aec955c17ffea96ef", - "version": "2.33.0" + "revision": "d6e3762e0a5f7ede652559f53623baf11006e17c", + "version": "2.39.0" } }, { @@ -312,8 +393,8 @@ "repositoryURL": "https://github.com/apple/swift-nio-http2.git", "state": { "branch": null, - "revision": "6e94a7be32891d1b303a3fcfde8b5bf64d162e74", - "version": "1.19.1" + "revision": "50c25c132b140e62b45e90b5a76f13ded02c8a46", + "version": "1.20.1" } }, { @@ -330,8 +411,8 @@ "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", "state": { "branch": null, - "revision": "2b329e37e9dd34fb382655181a680261d58cbbf1", - "version": "2.17.1" + "revision": "b5260a31c2a72a89fa684f5efb3054d8725a2316", + "version": "2.18.0" } }, { @@ -339,17 +420,35 @@ "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", "state": { "branch": null, - "revision": "e7f5278a26442dc46783ba7e063643d524e414a0", - "version": "1.11.3" + "revision": "8ab824b140d0ebcd87e9149266ddc353e3705a3e", + "version": "1.11.4" + } + }, + { + "package": "swift-numerics", + "repositoryURL": "https://github.com/apple/swift-numerics", + "state": { + "branch": null, + "revision": "0a5bc04095a675662cf24757cc0640aa2204253b", + "version": "1.0.2" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "e1499bc69b9040b29184f7f2996f7bab467c1639", + "version": "1.19.0" } }, { - "package": "swift-device-discovery", + "package": "SwiftDeviceDiscovery", "repositoryURL": "https://github.com/Apodini/SwiftDeviceDiscovery.git", "state": { "branch": null, - "revision": "76e3fdb5723e227d9fb8d631a9626d369850272c", - "version": "0.1.3" + "revision": "b68c2ddf63f9ac3e4c4a7a61b9e205ce22646645", + "version": "0.1.4" } }, { @@ -357,8 +456,8 @@ "repositoryURL": "https://github.com/vapor/websocket-kit.git", "state": { "branch": null, - "revision": "ff8fbce837ef01a93d49c6fb49a72be0f150dac7", - "version": "2.3.0" + "revision": "e32033ad3c68ebec1b761bc961be7bd56bad02f8", + "version": "2.3.1" } }, { diff --git a/Package.swift b/Package.swift index 4f686ab..378a88b 100644 --- a/Package.swift +++ b/Package.swift @@ -18,51 +18,51 @@ let package = Package( ], products: [ .library( - name: "DeploymentTargetIoT", - targets: ["DeploymentTargetIoT"] + name: "IoTDeploymentProvider", + targets: ["IoTDeploymentProvider"] ), .library( - name: "DeploymentTargetIoTRuntime", - targets: ["DeploymentTargetIoTRuntime"] + name: "IoTDeploymentProviderRuntime", + targets: ["IoTDeploymentProviderRuntime"] ), .library( - name: "DeploymentTargetIoTCommon", - targets: ["DeploymentTargetIoTCommon"] + name: "IoTDeploymentProviderCommon", + targets: ["IoTDeploymentProviderCommon"] ) ], dependencies: [ - .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.6.1")), - .package(name: "swift-device-discovery", url: "https://github.com/Apodini/SwiftDeviceDiscovery.git", .upToNextMinor(from: "0.1.0")), + .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.9.2")), + .package(url: "https://github.com/Apodini/SwiftDeviceDiscovery.git", .upToNextMinor(from: "0.1.3")), .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.0")) ], targets: [ .target( - name: "DeploymentTargetIoT", + name: "IoTDeploymentProvider", dependencies: [ .product(name: "ArgumentParser", package: "swift-argument-parser"), - .product(name: "SwiftDeviceDiscovery", package: "swift-device-discovery"), - .target(name: "DeploymentTargetIoTCommon"), - .product(name: "ApodiniDeployBuildSupport", package: "Apodini"), + .product(name: "SwiftDeviceDiscovery", package: "SwiftDeviceDiscovery"), + .target(name: "IoTDeploymentProviderCommon"), + .product(name: "ApodiniDeployerBuildSupport", package: "Apodini"), .product(name: "ApodiniUtils", package: "Apodini") ] ), .target( - name: "DeploymentTargetIoTRuntime", + name: "IoTDeploymentProviderRuntime", dependencies: [ - .product(name: "ApodiniDeployRuntimeSupport", package: "Apodini"), - .target(name: "DeploymentTargetIoTCommon") + .product(name: "ApodiniDeployerRuntimeSupport", package: "Apodini"), + .target(name: "IoTDeploymentProviderCommon") ] ), .target( - name: "DeploymentTargetIoTCommon", + name: "IoTDeploymentProviderCommon", dependencies: [ - .product(name: "ApodiniDeployBuildSupport", package: "Apodini") + .product(name: "ApodiniDeployerBuildSupport", package: "Apodini") ] ), .testTarget( - name: "IoTDeploymentTests", + name: "IoTDeploymentProviderTests", dependencies: [ - .target(name: "DeploymentTargetIoT") + .target(name: "IoTDeploymentProvider") ] ) ] diff --git a/README.md b/README.md index d783aa7..b940e17 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ If you use a raspberry pi, please make sure you have the following things set up - You need to have at least the Swift 5.5/ Swift 5.6 toolchain or docker installed on your raspberry pi. ## Setting up the provider -To allow the setup for custom user-defined actions and IoT devices, the IoT DP is a developed as a shared library that offers the `IoTDeploymentProvider`. This repository contains the `IoTDeploymentProvider` and `LifxIoTDeploymentTarget` that implements the provider with the support for [LIFX](https://www.lifx.com) lamps. +To allow the setup for custom user-defined actions and IoT devices, the IoT DP is a developed as a shared library that offers the `IoTDeploymentProvider`. This repository contains the `IoTDeploymentProvider`. Let's look at the following example to describe how the provider works and how one can set it up: Assume we have some LIFX smart lamps that are connected to our raspberry pi. We wrote a cool web service using [Apodini](https://github.com/Apodini/Apodini) that exposes among other, the functionality of the lights (e.g. on/off, control the brightness, etc.) via some endpoints. Now we want to deploy the web service to our raspberry pi using the IoT deployment provider. @@ -56,7 +56,7 @@ Text("Should not be visible") ) ``` -Once we are done, we create a second target, this time executable, and call into `LifxDeploymentProvider`. This will be our actual deployment provider. To make it work, we need to import the `IoTDeploymentTarget`. The `IoTDeploymentProvider` we are about to initialise takes a couple of arguments. If you already sure about these and just want a static provider, you can just pass the hardcoded parameters, otherwise we would suggest using `SwiftArgumentParser` to allow some customization from the command line. +Once we are done, we create a second target, this time executable, and call into `LifxDeploymentProvider`. This will be our actual deployment provider. To make it work, we need to import the `IoTDeploymentProvider`. The `IoTDeploymentProvider` we are about to initialise takes a couple of arguments. If you already sure about these and just want a static provider, you can just pass the hardcoded parameters, otherwise we would suggest using `SwiftArgumentParser` to allow some customization from the command line. Beside that we need to also import our newly created `LifxDeploymentOption` target as well as the `LifxPostDiscoveryAction` package we created in the beginning. After initializing the IoTDeploymentProvider property, we can call ```swift @@ -96,19 +96,19 @@ It is also possible to just pass a docker image as a post discovery action. Some provider.registerAction( scope: .all, action: .docker( - DockerDiscoveryAction( - identifier: ActionIdentifier("Lifx_Action"), - imageName: "my/image:latest-test", - fileUrl: URL(fileURLWithPath: "path/to/my/results/lifx_results.json"), - options: [ - .custom("--network=host"), - .port(hostPort: 56700, containerPort: 56700), - .volume(hostDir: "/usr/demo", containerDir: "/app/tmp"), - .credentials(username: "myUsername", password: "myPassword"), - .command("/app/tmp") - ] - ) - ), + DockerDiscoveryAction( + identifier: ActionIdentifier("Lifx_Action"), + imageName: "my/image:latest-test", + fileUrl: URL(fileURLWithPath: "path/to/my/results/lifx_results.json"), + options: [ + .custom("--network=host"), + .port(hostPort: 56700, containerPort: 56700), + .volume(hostDir: "/usr/demo", containerDir: "/app/tmp"), + .credentials(username: "myUsername", password: "myPassword"), + .command("/app/tmp") + ] + ) + ), option: .device(.lifx) ) ``` diff --git a/Sources/DeploymentTargetIoT/CreateDeploymentDirectoryAction.swift b/Sources/IoTDeploymentProvider/CreateDeploymentDirectoryAction.swift similarity index 100% rename from Sources/DeploymentTargetIoT/CreateDeploymentDirectoryAction.swift rename to Sources/IoTDeploymentProvider/CreateDeploymentDirectoryAction.swift diff --git a/Sources/DeploymentTargetIoT/CredentialStorage.swift b/Sources/IoTDeploymentProvider/CredentialStorage.swift similarity index 100% rename from Sources/DeploymentTargetIoT/CredentialStorage.swift rename to Sources/IoTDeploymentProvider/CredentialStorage.swift diff --git a/Sources/DeploymentTargetIoT/IoTContext.swift b/Sources/IoTDeploymentProvider/IoTContext.swift similarity index 100% rename from Sources/DeploymentTargetIoT/IoTContext.swift rename to Sources/IoTDeploymentProvider/IoTContext.swift diff --git a/Sources/DeploymentTargetIoT/IoTDeploymentOptions.swift b/Sources/IoTDeploymentProvider/IoTDeploymentOptions.swift similarity index 100% rename from Sources/DeploymentTargetIoT/IoTDeploymentOptions.swift rename to Sources/IoTDeploymentProvider/IoTDeploymentOptions.swift diff --git a/Sources/DeploymentTargetIoT/IoTDeploymentProvider+Redeployment.swift b/Sources/IoTDeploymentProvider/IoTDeploymentProvider+Redeployment.swift similarity index 100% rename from Sources/DeploymentTargetIoT/IoTDeploymentProvider+Redeployment.swift rename to Sources/IoTDeploymentProvider/IoTDeploymentProvider+Redeployment.swift diff --git a/Sources/DeploymentTargetIoT/IoTDeploymentProvider.swift b/Sources/IoTDeploymentProvider/IoTDeploymentProvider.swift similarity index 99% rename from Sources/DeploymentTargetIoT/IoTDeploymentProvider.swift rename to Sources/IoTDeploymentProvider/IoTDeploymentProvider.swift index 0b266ae..b080d24 100644 --- a/Sources/DeploymentTargetIoT/IoTDeploymentProvider.swift +++ b/Sources/IoTDeploymentProvider/IoTDeploymentProvider.swift @@ -7,13 +7,13 @@ // import Foundation -import ApodiniDeployBuildSupport +import ApodiniDeployerBuildSupport import ArgumentParser import DeviceDiscovery import Apodini import ApodiniUtils import Logging -import DeploymentTargetIoTCommon +import IoTDeploymentProviderCommon /// A deployment provider that handles the automatic deployment of a given web service to IoT devices in the network. diff --git a/Sources/DeploymentTargetIoT/KillSessionCommand.swift b/Sources/IoTDeploymentProvider/KillSessionCommand.swift similarity index 100% rename from Sources/DeploymentTargetIoT/KillSessionCommand.swift rename to Sources/IoTDeploymentProvider/KillSessionCommand.swift diff --git a/Sources/DeploymentTargetIoTCommon/IotCommon.swift b/Sources/IoTDeploymentProviderCommon/IotCommon.swift similarity index 98% rename from Sources/DeploymentTargetIoTCommon/IotCommon.swift rename to Sources/IoTDeploymentProviderCommon/IotCommon.swift index 9f86a89..fef8848 100644 --- a/Sources/DeploymentTargetIoTCommon/IotCommon.swift +++ b/Sources/IoTDeploymentProviderCommon/IotCommon.swift @@ -7,7 +7,7 @@ // import Apodini -import ApodiniDeployBuildSupport +import ApodiniDeployerBuildSupport import ApodiniUtils import Foundation diff --git a/Sources/DeploymentTargetIoTRuntime/IoTRuntime.swift b/Sources/IoTDeploymentProviderRuntime/IoTRuntime.swift similarity index 89% rename from Sources/DeploymentTargetIoTRuntime/IoTRuntime.swift rename to Sources/IoTDeploymentProviderRuntime/IoTRuntime.swift index 8626301..9c1dad0 100644 --- a/Sources/DeploymentTargetIoTRuntime/IoTRuntime.swift +++ b/Sources/IoTDeploymentProviderRuntime/IoTRuntime.swift @@ -7,12 +7,18 @@ // import Apodini -import ApodiniDeployRuntimeSupport +import ApodiniDeployerRuntimeSupport import ApodiniUtils import ArgumentParser -import DeploymentTargetIoTCommon +import IoTDeploymentProviderCommon import Foundation + +extension WebService { + /// The configuration for the IoT Deployment Provider + public typealias IoT = IoTRuntime +} + public class IoTRuntime: DeploymentProviderRuntime { public static var identifier: DeploymentProviderID { iotDeploymentProviderId @@ -38,7 +44,7 @@ public class IoTRuntime: DeploymentProviderRuntime { let node = deployedSystem.node(withId: currentNodeId), let launchInfo = node.readUserInfo(as: IoTLaunchInfo.self) else { - throw ApodiniDeployRuntimeSupportError( + throw ApodiniDeployerRuntimeSupportError( deploymentProviderId: Self.identifier, message: "Unable to read userInfo" ) @@ -60,7 +66,7 @@ public class IoTRuntime: DeploymentProviderRuntime { let LLI = invocation.targetNode.readUserInfo(as: IoTLaunchInfo.self), let url = URL(string: "\(LLI.host):\(LLI.port)") else { - throw ApodiniDeployRuntimeSupportError( + throw ApodiniDeployerRuntimeSupportError( deploymentProviderId: identifier, message: "Unable to read port and construct url" ) diff --git a/Sources/DeploymentTargetIoTRuntime/IoTStartupCommand.swift b/Sources/IoTDeploymentProviderRuntime/IoTStartupCommand.swift similarity index 95% rename from Sources/DeploymentTargetIoTRuntime/IoTStartupCommand.swift rename to Sources/IoTDeploymentProviderRuntime/IoTStartupCommand.swift index dcd438d..cfc1d63 100644 --- a/Sources/DeploymentTargetIoTRuntime/IoTStartupCommand.swift +++ b/Sources/IoTDeploymentProviderRuntime/IoTStartupCommand.swift @@ -7,10 +7,10 @@ // import Apodini -import ApodiniDeployRuntimeSupport +import ApodiniDeployerRuntimeSupport import ApodiniUtils import ArgumentParser -import DeploymentTargetIoTCommon +import IoTDeploymentProviderCommon import Foundation public struct IoTStartupCommand: DeploymentStartupCommand { @@ -18,7 +18,7 @@ public struct IoTStartupCommand: DeploymentStartupCommand { CommandConfiguration( commandName: "iot", abstract: "Start a web service - IoT", - discussion: "Starts up an Apodini web service for the iot deployment", + discussion: "Starts up an Apodini web service for the IoT deployment", version: "0.0.1" ) } diff --git a/Sources/DeploymentTargetIoTRuntime/IoTStructureExporterCommand.swift b/Sources/IoTDeploymentProviderRuntime/IoTStructureExporterCommand.swift similarity index 97% rename from Sources/DeploymentTargetIoTRuntime/IoTStructureExporterCommand.swift rename to Sources/IoTDeploymentProviderRuntime/IoTStructureExporterCommand.swift index 7561140..192afd4 100644 --- a/Sources/DeploymentTargetIoTRuntime/IoTStructureExporterCommand.swift +++ b/Sources/IoTDeploymentProviderRuntime/IoTStructureExporterCommand.swift @@ -7,10 +7,10 @@ // import Apodini -import ApodiniDeployRuntimeSupport +import ApodiniDeployerRuntimeSupport import ApodiniUtils import ArgumentParser -import DeploymentTargetIoTCommon +import IoTDeploymentProviderCommon import Foundation public struct IoTStructureExporterCommand: StructureExporter { diff --git a/Tests/IoTDeploymentTests/IoTDeploymentTests.swift b/Tests/IoTDeploymentProviderTests/IoTDeploymentProviderTests.swift similarity index 100% rename from Tests/IoTDeploymentTests/IoTDeploymentTests.swift rename to Tests/IoTDeploymentProviderTests/IoTDeploymentProviderTests.swift diff --git a/scripts/setup-IoT.sh b/scripts/setup-IoT.sh index 87ef0ba..0d90d4e 100755 --- a/scripts/setup-IoT.sh +++ b/scripts/setup-IoT.sh @@ -4,25 +4,24 @@ # # SPDX-License-Identifier: MIT -echo "Setting up Raspberry Pi for Deployment" -echo "Updating/Upgrading everything" -apt-get -y -q update -apt-get -y -q upgrade -echo "Installing avahi-utils" -apt-get -y install avahi-utils -echo "Installing avahi-daemon" -apt-get -y install avahi-daemon -systemctl enable avahi-daemon.service -systemctl start avahi-daemon.service +export DEBIAN_FRONTEND=noninteractive +export NEEDRESTART_MODE=a -echo "Updating avahi config" -publish_hinfo='yes' -publish-workstation='yes' -sed -i "s/^publish-hinfo=.*/publish-hinfo=yes/" /etc/avahi/avahi-daemon.conf -sed -i "s/^publish-workstation=.*/publish-workstation=yes/" /etc/avahi/avahi-daemon.conf +sudo DEBIAN_FRONTEND=noninteractive apt-get -y update +sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade -systemctl restart avahi-daemon.service +# Download and start avahi -echo "Setup complete." +sudo DEBIAN_FRONTEND=noninteractive apt-get -y install avahi-utils avahi-daemon +sudo sed -i "s/^publish-hinfo=.*/publish-hinfo=yes/" /etc/avahi/avahi-daemon.conf +sudo sed -i "s/^publish-workstation=.*/publish-workstation=yes/" /etc/avahi/avahi-daemon.conf + +sudo systemctl enable avahi-daemon.service +sudo systemctl start avahi-daemon.service + + +# Reboot + +sudo systemctl reboot