diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5dacfb5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,61 @@ +name: build + +on: + workflow_dispatch: + push: + branches: + - master + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-latest + - ubuntu-latest + # - macos-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + - uses: Swatinem/rust-cache@v2 + - name: Prepare OpenCL SDK + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + if [[ "$RUNNER_OS" == "Windows" ]]; then + VERSION=$(gh release view --repo KhronosGroup/OpenCL-SDK --json tagName --jq .tagName) + gh release download --repo KhronosGroup/OpenCL-SDK --pattern "OpenCL-SDK-${VERSION}-Win-x64.zip" + unzip "OpenCL-SDK-${VERSION}-Win-x64.zip" + cp "OpenCL-SDK-${VERSION}-Win-x64/lib/OpenCL.lib" OpenCL.lib + fi + if [[ "$RUNNER_OS" == "Linux" ]]; then + sudo apt install opencl-headers ocl-icd-opencl-dev + fi + # FIXME + # if [[ "$RUNNER_OS" == "macOS" ]]; then + # + # fi + - name: Build + id: build + shell: bash + run: | + if [[ "$RUNNER_OS" == "Windows" ]]; then + export RUSTFLAGS="--remap-path-prefix C:\\Users\\runneradmin=~" + else + export RUSTFLAGS="--remap-path-prefix $HOME=~" + fi + cargo build --release + if [[ "$RUNNER_OS" == "Windows" ]]; then + echo "executable=target/release/opencl_vanity_gpg.exe" >> $GITHUB_OUTPUT + else + echo "executable=target/release/opencl_vanity_gpg" >> $GITHUB_OUTPUT + fi + - name: Upload result + uses: actions/upload-artifact@v4 + with: + name: opencl_vanity_gpg-${{ runner.os }} + path: ${{ steps.build.outputs.executable }} diff --git a/README.md b/README.md index c0841c0..8436707 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ 目前最好的同类工具是使用 CPU 的 [RedL0tus/VanityGPG](https://github.com/RedL0tus/VanityGPG) 和使用 GPU(CUDA)的 [cuihaoleo/gpg-fingerprint-filter-gpu](https://github.com/cuihaoleo/gpg-fingerprint-filter-gpu)。这个项目是使用 GPU(OpenCL)实现的,优点当然是开箱即用了。 -> TODO: GitHub Actions 自动编译 +GitHub Actions 有自动编译好的二进制文件。 # 使用方法 diff --git a/src/utils/args.rs b/src/utils/args.rs index 260de50..36515c7 100644 --- a/src/utils/args.rs +++ b/src/utils/args.rs @@ -84,7 +84,7 @@ pub struct Args { impl Default for Args { fn default() -> Self { Self { - cipher_suite: CipherSuite::RSA3072, + cipher_suite: CipherSuite::Ed25519, user_id: String::from("Dummy "), pattern: Some(String::from("XXXYYYZZZWWW")), filter: None,