Skip to content

Commit dfde63b

Browse files
authored
adding go port, refactoring Dockerfile and adding release workflows (#2)
* refactor: using ADD instead of wget for dockerfile * feat: adding go port for AntispamAPI * feat: adding github workflows for build and release * fix: change in variable name * fix: workflow release bug
1 parent 451cdae commit dfde63b

File tree

3 files changed

+49
-5
lines changed

3 files changed

+49
-5
lines changed

.github/workflows/rust.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: build and release
2+
3+
on:
4+
push:
5+
branches: [master]
6+
release:
7+
types: [created]
8+
9+
env:
10+
RUST_BACKTRACE: full
11+
12+
jobs:
13+
build-and-release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Install Rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
profile: minimal
23+
toolchain: stable
24+
25+
- name: Build
26+
run: cargo build --release --verbose
27+
28+
- name: Archive binary
29+
uses: actions/upload-artifact@v2
30+
with:
31+
name: tg_antispam_rs
32+
path: target/release/tg_antispam_rs
33+
34+
- name: Create release
35+
uses: softprops/action-gh-release@v1
36+
if: github.event_name == 'release'
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.SECRET_TOKEN }}
39+
with:
40+
files: target/release/tg_antispam_rs
41+
tag_name: ${{ github.ref }}
42+
name: Release ${{ github.ref }}
43+
body: ${{ github.event.release.body }}
44+
draft: false
45+
prerelease: false

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ FROM debian:buster-slim
1616
COPY --from=rust-builder /usr/src/app/target/release/tg_antispam_rs /usr/local/bin/
1717
WORKDIR /usr/local/bin
1818

19-
RUN apt-get update
20-
RUN apt-get install wget -y
21-
RUN wget "https://huggingface.co/datasets/thehamkercat/telegram-spam-ham/raw/main/dataset.csv"
19+
20+
ADD https://huggingface.co/datasets/thehamkercat/telegram-spam-ham/raw/main/dataset.csv dataset.csv
2221

2322
CMD ["tg_antispam_rs"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- The dataset provided may contain some NSFW texts or personal info, it's not thoroughly checked.
99
- I've included a docker-based example, but you can run it without docker as well.
1010
- `profanity` in response is only there to maintain backwards compatibility for ARQ users, it always returns `false`
11-
1211
## Installation:
1312
I would suggest using docker compose for this, but it's upto you!
1413
### With Docker compose
@@ -51,8 +50,9 @@ content-type: application/json
5150
"spam_probability": 99
5251
}
5352
```
53+
### A Go port for the same API can be found [here](https://github.com/axrav/AntispamAPI)
5454

55-
## Usage example:
55+
## Usage examples:
5656
### Python
5757

5858
```python

0 commit comments

Comments
 (0)