Squashed 'components/mycelium/' content from commit afb32e0

git-subtree-dir: components/mycelium
git-subtree-split: afb32e0cdb2d4cdd17f22a5693278068d061f08c
This commit is contained in:
2025-08-16 21:12:34 +02:00
commit 10025f9fa5
132 changed files with 50951 additions and 0 deletions

31
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
mycelium:
patterns:
- "*"
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/myceliumd" # Location of package manifests
schedule:
interval: "weekly"
groups:
myceliumd:
patterns:
- "*"
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/myceliumd-private" # Location of package manifests
schedule:
interval: "weekly"
groups:
myceliumd-private:
patterns:
- "*"

133
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,133 @@
name: ci
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
check_fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: clechasseur/rs-fmt-check@v2
clippy:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set windows VCPKG_ROOT env variable
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
if: runner.os == 'Windows'
- name: Install windows openssl
run: vcpkg install openssl:x64-windows-static-md
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-features -- -Dwarnings
check_library:
strategy:
matrix:
os: [ubuntu-latest, macos-latest,windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set windows VCPKG_ROOT env variable
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
if: runner.os == 'Windows'
- name: Install windows openssl
run: vcpkg install openssl:x64-windows-static-md
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- name: Build
run: cargo build -p mycelium --all-features --verbose
- name: Run tests
run: cargo test -p mycelium --all-features --verbose
check_ios_library:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: install ios target
run: rustup target add aarch64-apple-ios
- name: Cache cargo
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --target aarch64-apple-ios
working-directory: mobile
check_android_library:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install android target
run: rustup target add aarch64-linux-android
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Set up Android NDK
uses: android-actions/setup-android@v3
- name: Accept Android Licenses
run: yes | sdkmanager --licenses || true
- name: Cache cargo
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: install cargo NDK
run: cargo install cargo-ndk
- name: Build
run: cargo ndk -t arm64-v8a build
working-directory: mobile
check_binaries:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
binary: [myceliumd, myceliumd-private]
runs-on: ${{ matrix.os }}
steps:
- name: Set windows VCPKG_ROOT env variable
run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
if: runner.os == 'Windows'
- name: Install windows openssl
run: vcpkg install openssl:x64-windows-static-md
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- name: Change directory to binary
run: cd ${{ matrix.binary }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run Clippy
run: cargo clippy --all-features -- -Dwarnings
check_flake:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
id-token: "write"
contents: "read"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/flake-checker-action@main
- name: Run `nix build`
run: nix build .

121
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,121 @@
name: Release
permissions:
contents: write
on:
push:
tags:
- v[0-9]+.*
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
# (required) GitHub token for creating GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
upload-assets-mycelium:
needs: create-release
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# Name of the compiled binary, also name of the non-extension part of the produced file
bin: mycelium
# --target flag value, default is host
target: ${{ matrix.target }}
# Name of the archive when uploaded
archive: $bin-$target
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
# Specify manifest since we are in a subdirectory
manifest-path: myceliumd/Cargo.toml
# TODO: Figure out the correct matrix setup to have this in a single action
upload-assets-myceliumd-private:
needs: create-release
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# Name of the compiled binary, also name of the non-extension part of the produced file
bin: mycelium-private
# Set the vendored-openssl flag for provided release builds
features: vendored-openssl
# --target flag value, default is host
target: ${{ matrix.target }}
# Name of the archive when uploaded
archive: $bin-$target
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
# Specify manifest since we are in a subdirectory
manifest-path: myceliumd-private/Cargo.toml
build-msi:
needs: create-release
runs-on: windows-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Create .exe file
shell: bash
run: cd myceliumd && RUSTFLAGS="-C target-feature=+crt-static" cargo build --release && cd ..
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4.0.0
- name: Install WiX Toolset
run: dotnet tool install --global wix
- name: Add WixToolset.UI.wixext extension
run: wix extension add WixToolset.UI.wixext
- name: Download Wintun zip file
run: curl -o wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip
- name: Unzip Wintun
run: unzip wintun.zip
- name: Move .dll file to myceliumd directory
run: move wintun\bin\amd64\wintun.dll myceliumd
- name: Build MSI package
run: wix build -loc installers\windows\wix\mycelium.en-us.wxl installers\windows\wix\mycelium.wxs -ext WixToolset.UI.wixext -arch x64 -dcl high -out mycelium_installer.msi
- name: Upload MSI artifact
uses: alexellis/upload-assets@0.4.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["mycelium_installer.msi"]'