-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from LBRYFoundation/adding-actions
New GitHub Action! Now in your local area!
- Loading branch information
Showing
9 changed files
with
240 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
eslint: | ||
name: ESLint Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run ESLint | ||
run: bun run eslint . | ||
|
||
prettier: | ||
name: Prettier Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run Prettier | ||
run: bun run prettier --check . | ||
|
||
tsc: | ||
name: TypeScript Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run TypeScript Compiler | ||
run: bun run tsc --noEmit | ||
|
||
build-macos: | ||
name: Build CLI (macOS) | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Build CLI for x64 | ||
run: bun build:cli --target=bun-darwin-x64 --outfile=dist/cli/macos/cli_macos_x64 | ||
|
||
- name: Build CLI for arm64 | ||
run: bun build:cli --target=bun-darwin-arm64 --outfile=dist/cli/macos/cli_macos_arm64 | ||
|
||
- name: Combine binaries using lipo | ||
run: | | ||
lipo -create -output dist/cli/macos/cli_macos dist/cli/macos/cli_macos_arm64 dist/cli/macos/cli_macos_x64 | ||
build-windows: | ||
name: Build CLI (Windows) | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Build CLI for x64 | ||
run: bun build:cli --target=bun-windows-x64 --outfile=dist/cli/windows/cli_windows_x64.exe | ||
|
||
- name: Build CLI for x64 (baseline) | ||
run: bun build:cli --target=bun-windows-x64-baseline --outfile=dist/cli/windows/cli_windows_x64_baseline.exe | ||
|
||
- name: Use Resource Hacker | ||
run: | | ||
ResourceHacker.exe -open dist/cli/windows/cli_windows_x64.exe -save dist/cli/windows/cli_windows_x64.exe -action addoverwrite -res resource.res | ||
ResourceHacker.exe -open dist/cli/windows/cli_windows_x64_baseline.exe -save dist/cli/windows/cli_windows_x64_baseline.exe -action addoverwrite -res resource.res | ||
build-linux: | ||
name: Build CLI (Linux) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Build CLI for x64 | ||
run: bun build:cli --target=bun-linux-x64 --outfile=dist/cli/linux/cli_linux_x64 | ||
|
||
- name: Build CLI for x64 (baseline) | ||
run: bun build:cli --target=bun-linux-x64-baseline --outfile=dist/cli/linux/cli_linux_x64_baseline | ||
|
||
- name: Build CLI for arm64 | ||
run: bun build:cli --target=bun-linux-arm64 --outfile=dist/cli/linux/cli_linux_arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,10 @@ | |
lbrynet | ||
lbrynet.exe | ||
settings.json | ||
cli.exe | ||
cli | ||
gui.exe | ||
gui | ||
./cli.exe | ||
./cli | ||
./gui.exe | ||
./gui | ||
|
||
# Logs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { number, input, confirm } from '@inquirer/prompts' | ||
import colors from 'colors' | ||
import type { Settings } from '../../types/settings' | ||
import type { BunFile } from 'bun' | ||
|
||
const theme = { | ||
prefix: '?', | ||
style: { | ||
message: colors.blue, | ||
defaultAnswer: (text: string) => `[${text}]`.gray | ||
} | ||
} | ||
|
||
const requestSettings = async ( | ||
file: BunFile, | ||
configError: boolean | ||
): Promise<Settings> => { | ||
console.log( | ||
configError | ||
? 'There was an error reading your settings file. Set them up again to start bookbuddies.' | ||
.red.bold | ||
: "Welcome to bookbuddies! Let's get some initial settings sorted.\nYou can always change these while bookbuddies is running.\n" | ||
.yellow | ||
) | ||
const settings: Settings = { | ||
version: 1, | ||
storageSpace: 10, | ||
username: null, | ||
sentry: false, | ||
advanced: { | ||
rpcPort: 5279, | ||
udpPort: 4444, | ||
tcpPort: 4444 | ||
} | ||
} | ||
settings.storageSpace = | ||
(await number({ | ||
message: 'How much storage space should bookbuddies use in GB?', | ||
default: 10, | ||
theme | ||
})) || 10 | ||
settings.username = await input({ | ||
message: | ||
"Provide a name if you want to. This is only for the LBRY Foundation, to see who's contributing.", | ||
theme | ||
}) | ||
settings.sentry = await confirm({ | ||
message: | ||
'Do you want to send error and performance reports to the LBRY Foundation? This will be done via Sentry, and will help us improve bookbuddies.', | ||
default: false, | ||
theme | ||
}) | ||
if ( | ||
await confirm({ | ||
message: 'Do you want to set advanced LBRY SDK settings?', | ||
default: false, | ||
theme | ||
}) | ||
) { | ||
settings.advanced.rpcPort = | ||
(await number({ | ||
message: 'What port should the LBRY SDK use for JSON-RPC?', | ||
default: 5279, | ||
min: 1024, | ||
max: 65535, | ||
theme | ||
})) || 5279 | ||
settings.advanced.udpPort = | ||
(await number({ | ||
message: | ||
'What port should the LBRY SDK use for UDP communication for seeding?', | ||
default: 4444, | ||
min: 1024, | ||
theme | ||
})) || 4444 | ||
settings.advanced.tcpPort = | ||
(await number({ | ||
message: | ||
'What port should the LBRY SDK use for TCP communication for seeding?', | ||
default: 4444, | ||
min: 1024, | ||
max: 65535, | ||
theme | ||
})) || 4444 | ||
} | ||
|
||
console.log(settings) | ||
await Bun.write(file, JSON.stringify(settings, null, 4)) | ||
return settings | ||
} | ||
|
||
export default async (): Promise<Settings> => { | ||
const settingsFile = Bun.file('settings.json') | ||
return await requestSettings(settingsFile, true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default process.env.SENTRY_DSN || null | ||
export default process.env.SENTRY_DSN || null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import 'colors' | ||
|
||
console.log('Not implemented yet.'.red) | ||
console.log('Not implemented yet.'.red) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export type Settings = { | ||
version: number | ||
storageSpace: number | ||
username: string | null | ||
sentry: boolean | ||
advanced: { rpcPort: number; udpPort: number; tcpPort: number } | ||
} | ||
version: number | ||
storageSpace: number | ||
username: string | null | ||
sentry: boolean | ||
advanced: { rpcPort: number; udpPort: number; tcpPort: number } | ||
} |