Files
pubky-core/.github/workflows/pr-check.yml
Severin Alexander Bühler 55d52ec4b8 chore(homeserver): Refactor Core (#96)
* first draft

* config2 for the time being

* more refactoring

* write default config if it doesnt exist

* added relays to config

* some refactor

* proper bootstrap nodes and relay config validation

* small comments

* rename module

* renamings

* turn listen_ports to listen_socket

* connected config with homeserver

* cleaned up old config

* cleaned up config_old

* removed old config.example.toml

* cleanup tryfrom conversions

* removed dirs-next

* review cleanup

* extracted default config to its own toml file

* use hostname_validator for rfc1123 domain verification

* Domain struct

* fmt

* small config restructure

* use SignupMode in config and moved it to config dir

* moved and simplified lmdb

* save to switch branches

* lots done already

* missin lock file

* pkarr config

* constants

* app context

* used context in more places

* made homeserver independant

* testing feature

* added datadirmock

* getting the hang about testing

* fixed homeserver core tests

* added HandleHolder

* make the homeserver tasks stop when its dropped

* make server handles optional

* properly cleanup all background tasks

* moved logs

* fixed config default toml

* fmt, clippy

* moved stuff around

* lots of moving and readme

* fixed pkarr republisher tests

* removed docs from include

* fixed and refactored testnet

* make simple_testnet work

* httprelay shutdown

* different testnets

* fixing tests1

* fixing tests

* fixing more tests

* unified pkarr versions

* fixed config with bootstrap nodes and relays

* split up test_republish_on_signin to prevent timing issues

* fixed all tests in e2e?

* fixed multi publisher tests

* fixed pubky-client readme

* fixed testnet readme

* added better errors

* admin error

* fixed tests

* format

* clippy

* cllippy

* fixed testnet ports

* fixed client future issue

* improved testnet

* fixed cache_size pkarr relay issue

* small improvements

* fixed low prio dns record

* removed fixed testnet test due to port conflicts

* fixed browserify issues

* fmt

* clippy

* changed wait for testnet hs admin

* fixed docs clippy issues

* added comments

* moved icann_domain

* renamed datadirs

* implemented default for MockDataDir

* renamed run() to start()

* removed unwraps

* fmt

* fixed rename test

* cleaned up admin trace

* added santity values for periodic backup conf and user keys republisher

* fmt

* fmt

* fixed readme lint

* removed println

* fixed admin server edge to anyhow

* added ipv6 support

* removed unnecessary expects

* renamed testnet

* fmt

* renamed me

* changed import

* fmt
2025-04-18 10:00:43 +03:00

131 lines
3.4 KiB
YAML

name: PR Check
on:
pull_request:
push:
branches: [main]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- name: Check formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Lint with Clippy
run: cargo clippy --workspace --all-features -- -D warnings -A clippy::needless_lifetimes
test:
strategy:
matrix:
crate:
[pubky, pubky-common, pubky-homeserver, pubky-testnet, http-relay, pkarr-republisher, e2e]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install Nextest
uses: taiki-e/install-action@nextest
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run doctests and nextest
run: |
set -e
# nextest does not support doctests yet.
cargo test --doc -p ${{ matrix.crate }} --all-features
if cargo nextest run \
-p ${{ matrix.crate }} \
--all-features \
--test-threads num-cpus \
--retries 2 \
--no-fail-fast \
--verbose; then
echo "Tests passed for ${{ matrix.crate }}"
else
if [ $? -eq 4 ]; then
echo "No tests found for ${{ matrix.crate }}"
exit 0
else
echo "Tests failed for ${{ matrix.crate }}"
exit 1
fi
fi
wasm-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build WASM
working-directory: pubky-client/pkg
run: |
npm install
npm run build
- name: Run the testnet
working-directory: pubky-client/pkg
run: npm run testnet > testnet.log 2>&1 &
- name: Wait for testnet homeserver
run: |
until nc -zv 127.0.0.1 6288; do
echo "Waiting for testnet homeserver to be ready..."
sleep 1
done
- name: Run Tests (only node-js)
working-directory: pubky-client/pkg
# runing only `test-nodjs` and not browser because of weird `exit` behavior
run: npm run test-nodejs
- name: Show testnet logs if tests fail
working-directory: pubky-client/pkg
if: failure()
run: cat testnet.log