Skip to content

Commit

Permalink
book: test Swift
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Nov 16, 2024
1 parent 0129f9c commit 70aa95c
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 8 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,23 @@ jobs:
- name: Check
run: just check-book

check-swift:
name: Check book (Swift)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install just
run: cargo install just

- name: Test Swift
working-directory: book/snippets
run: just test-swift

deploy:
name: Deploy book
needs: [check-book]
needs: [check-book, check-swift]
if: github.ref == 'refs/heads/master'
environment:
name: github-pages
Expand All @@ -67,4 +81,4 @@ jobs:

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
uses: actions/deploy-pages@v3
5 changes: 5 additions & 0 deletions book/snippets/justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
test:
cd nostr && just test
cd nostr-sdk && just test

[macos]
test-swift:
cd nostr && just swift
cd nostr-sdk && just swift
4 changes: 4 additions & 0 deletions book/snippets/nostr-sdk/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ js:
kotlin:
#cd kotlin && just test
echo TODO

swift:
#cd swift && just test
echo TODO
4 changes: 3 additions & 1 deletion book/snippets/nostr/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ js:

kotlin:
cd kotlin && just test


swift:
cd swift && just test
9 changes: 8 additions & 1 deletion book/snippets/nostr/swift/NostrSnippets/Sources/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@ import NostrSDK
import Foundation

func keys() {
// TODO
// ANCHOR: generate
let keys = Keys.generate()
print("Public key (hex): \(keys.publicKey.toHex())")
print("Secret key (hex): \(keys.secretKey.toHex())")

print("Public key (bech32): \(keys.publicKey.toBech32())")
print("Secret key (bech32): \(keys.secretKey.toBech32())")
// ANCHOR_END: generate
}
3 changes: 3 additions & 0 deletions book/snippets/nostr/swift/NostrSnippets/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


keys()
4 changes: 0 additions & 4 deletions book/snippets/nostr/swift/NostrSnippets/justfile

This file was deleted.

4 changes: 4 additions & 0 deletions book/snippets/nostr/swift/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env just --justfile

test:
cd NostrSnippets && swift build && swift run

0 comments on commit 70aa95c

Please sign in to comment.