Skip to content

Commit

Permalink
Migrated from another repository
Browse files Browse the repository at this point in the history
  • Loading branch information
dialogflowchatbot committed Jan 6, 2024
0 parents commit 195386f
Show file tree
Hide file tree
Showing 85 changed files with 5,129 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build]
# rustflags = ["-C", "target-cpu=native"]
# rustdocflags = ["-C", "target-cpu=native"]

[target.wasm32-unknown-unknown]
# rustflags = ["-C", "target-feature=+simd128"]

[target.wasm32-wasi]
# rustflags = ["-C", "target-feature=+simd128"]
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
222 changes: 222 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
name: Tests and release
# on: [push, pull_request]
on:
push:
pull_request:
branches: [main]
paths-ignore: ["samples/**", "**.md"]
env:
CRATE_NAME: dialogflow
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
jobs:
test:
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#choosing-self-hosted-runners
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
# Platforms that don't work:
#
# - sparc64-unknown-linux-gnu - cannot compile openssl-sys
# - x86_64-unknown-illumos - weird error compiling openssl - "bin/sh: 1: granlib: not found"

# - os_name: FreeBSD-x86_64
# os: ubuntu-20.04
# target: x86_64-unknown-freebsd
# bin: dialogflow
# name: dialogflow-FreeBSD-x86_64.tar.gz
# skip_tests: true
# - os_name: Linux-x86_64
# os: ubuntu-20.04
# target: x86_64-unknown-linux-musl
# bin: dialogflow
# name: dialogflow-Linux-x86_64-musl.tar.gz
# skip_tests: true
# - os_name: Linux-aarch64
# os: ubuntu-20.04
# target: aarch64-unknown-linux-musl
# bin: dialogflow
# name: dialogflow-Linux-aarch64-musl.tar.gz
# - os_name: Linux-arm
# os: ubuntu-20.04
# target: arm-unknown-linux-musleabi
# bin: dialogflow
# name: dialogflow-Linux-arm-musl.tar.gz
# Linux 32-bit
# - os_name: Linux-i686
# os: ubuntu-20.04
# target: i686-unknown-linux-musl
# bin: dialogflow
# name: dialogflow-Linux-i686-musl.tar.gz
# skip_tests: true
# - os_name: Linux-mips
# os: ubuntu-20.04
# target: mips-unknown-linux-musl
# bin: dialogflow
# name: dialogflow-Linux-mips.tar.gz
# - os_name: Linux-mipsel
# os: ubuntu-20.04
# target: mipsel-unknown-linux-musl
# bin: dialogflow
# name: dialogflow-Linux-mipsel.tar.gz
# - os_name: Linux-mips64
# os: ubuntu-20.04
# target: mips64-unknown-linux-muslabi64
# bin: dialogflow
# name: dialogflow-Linux-mips64.tar.gz
# skip_tests: true
# - os_name: Linux-mips64el
# os: ubuntu-20.04
# target: mips64el-unknown-linux-muslabi64
# bin: dialogflow
# name: dialogflow-Linux-mips64el.tar.gz
# skip_tests: true
# - os_name: Linux-powerpc
# os: ubuntu-20.04
# target: powerpc-unknown-linux-gnu
# bin: dialogflow
# name: dialogflow-Linux-powerpc-gnu.tar.gz
# skip_tests: true
# - os_name: Linux-powerpc64
# os: ubuntu-20.04
# target: powerpc64-unknown-linux-gnu
# bin: dialogflow
# name: dialogflow-Linux-powerpc64-gnu.tar.gz
# skip_tests: true
# - os_name: Linux-powerpc64le
# os: ubuntu-20.04
# target: powerpc64le-unknown-linux-gnu
# bin: dialogflow
# name: dialogflow-Linux-powerpc64le.tar.gz
# skip_tests: true
# - os_name: Linux-riscv64
# os: ubuntu-20.04
# target: riscv64gc-unknown-linux-gnu
# bin: dialogflow
# name: dialogflow-Linux-riscv64gc-gnu.tar.gz
# - os_name: Linux-s390x
# os: ubuntu-20.04
# target: s390x-unknown-linux-gnu
# bin: dialogflow
# name: dialogflow-Linux-s390x-gnu.tar.gz
# skip_tests: true
# - os_name: NetBSD-x86_64
# os: ubuntu-20.04
# target: x86_64-unknown-netbsd
# bin: dialogflow
# name: dialogflow-NetBSD-x86_64.tar.gz
# skip_tests: true
# - os_name: Windows-aarch64
# os: windows-latest
# target: aarch64-pc-windows-msvc
# bin: dialogflow.exe
# name: dialogflow-Windows-aarch64.zip
# skip_tests: true
# Windows 32-bit
# - os_name: Windows-i686
# os: windows-latest
# target: i686-pc-windows-msvc
# bin: dialogflow.exe
# name: dialogflow-Windows-i686.zip
# skip_tests: true
# - os_name: Windows-x86_64
# os: windows-2019
# target: x86_64-pc-windows-msvc
# bin: dialogflow.exe
# name: dialogflow-Windows-x86_64.zip
# skip_tests: true
- os_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: dialogflow
name: dialogflow-Darwin-x86_64.tar.gz
- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: dialogflow
name: dialogflow-Darwin-aarch64.tar.gz
skip_tests: true
toolchain:
- stable
# - beta
# - nightly
steps:
- uses: actions/checkout@v3
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
key: "v2"
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Songday"
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
if: contains(matrix.platform.name, 'musl')
- name: Install build-essential on Linux
run: sudo apt-get install --yes build-essential pkg-config libssl-dev
if: contains(matrix.platform.name, 'musl')
- name: Link g++
run: sudo ln -s /bin/g++ /bin/musl-g++
if: contains(matrix.platform.name, 'musl')
- name: Install rust target
run: rustup target add ${{ matrix.platform.target }} --toolchain ${{ matrix.toolchain }}
- name: Build binary
run: cargo build --release --verbose --target ${{ matrix.platform.target }}
# uses: houseabsolute/actions-rust-cross@v0
# with:
# command: "build"
# target: ${{ matrix.platform.target }}
# toolchain: ${{ matrix.toolchain }}
# # args: "--locked --release"
# args: "--release"
# strip: false
- name: Run tests
uses: houseabsolute/actions-rust-cross@v0
with:
command: "test"
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
# args: "--locked --release"
args: "--release"
if: ${{ !matrix.platform.skip_tests }}
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
osstr="${{ matrix.platform.os }}"
if [[ "${osstr:0:7}" == "windows" ]]; then
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
if: matrix.toolchain == 'stable'
# if: |
# matrix.toolchain == 'stable' &&
# ( startsWith( github.ref, 'refs/tags/v' ) ||
# github.ref == 'refs/tags/test-release' )
- name: Publish release artifacts
uses: actions/upload-artifact@v3
with:
name: dialogflow-${{ matrix.platform.os_name }}
path: "dialogflow-*"
# if: matrix.toolchain == 'stable' && github.ref == 'refs/tags/test-release'
if: matrix.toolchain == 'stable'
# - name: Generate SHA-256
# run: shasum -a 256 ${{ matrix.platform.name }}
# if: |
# matrix.toolchain == 'stable' &&
# matrix.platform.os == 'macOS-latest' &&
# ( startsWith( github.ref, 'refs/tags/v' ) ||
# github.ref == 'refs/tags/test-release' )
# - name: Publish GitHub release
# uses: softprops/action-gh-release@v1
# with:
# draft: true
# files: "dialogflow*"
# body_path: Changes.md
# if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
src/resources/assets/*.gz
src/resources/assets/assets/*.gz
flow.db
dialogflow.exe
TODO.txt
index.html
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
".\\Cargo.toml"
]
}
79 changes: 79 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[package]
name = "dialogflow"
version = "1.9.0"
edition = "2021"
homepage = "https://dialogflowchatbot.github.io/"
authors = ["dialogflowchatbot <[email protected]>"]

[lib]
name = "dialogflow"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

# https://github.com/djkoloski/rust_serialization_benchmark

[dependencies]
# artful = "0.1.1"
axum = {version = "0.7", features = ["query"]}
colored = "2.1"
# dashmap = "5.5.1"
enum_dispatch = "0.3"
erased-serde = "0.4"
itoa = "1.0"
# jieba-rs = "0.6.7"
once_cell = "1.19"
redb = "1.4"
regex = "1.10"
reqwest = "0.11"
rkyv = {version = "0.7", features = ["validation"]}
scru128 = "3.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
scraper = "0.18"
# snmalloc-rs = "0.3.4" # 暂时不支持MUSL
# simd-json = "0.10"
# simsearch = "0.2"
# strsim = "0.10.0"
# textdistance = "1.0.2"
time = { version = "0.3", features = ["formatting"] }
tower-http = { version = "0.5", features = ["cors"] }
# typetag = "0.2"
tokio = { version = "1", features = ["fs", "io-util", "macros", "net", "rt", "rt-multi-thread", "signal", "time"] }
tracing-subscriber = "0.3"
# triple_accel = "0.4.0"

[build-dependencies]
flate2 = "1.0"

[target.'cfg(windows)'.dependencies]
windows = {version = "0.52", features = ["Win32_Globalization","Win32_System_SystemServices"]}

# https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
# https://doc.rust-lang.org/reference/conditional-compilation.html
[target.'cfg(target_env = "gnu")'.dependencies]
[target.'cfg(target_env = "musl")'.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

[profile.dev]
debug = 2
debug-assertions = true
overflow-checks = true
opt-level = 0
lto = false
panic = 'unwind'
rpath = false

[profile.test]
debug = 1

[profile.bench]
debug = 1

[profile.release]
debug = false
debug-assertions = false
overflow-checks = false
opt-level = 3
codegen-units = 1
lto = true
panic = 'abort'
Loading

0 comments on commit 195386f

Please sign in to comment.