Skip to content

Commit

Permalink
use just and build release on ci (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
extrawurst authored Dec 3, 2024
1 parent c3c2270 commit b31c18c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: extractions/setup-just@v1

- name: Login to Docker Hub
run: |
docker login \
-u ${{ secrets.DOCKER_USERNAME }} \
-p ${{ secrets.DOCKER_PASSWORD }}
- name: Download CSVs
run: make download
run: just download

- name: Build Docker image
run: docker build -t extrawurst/ip2country:latest -f Dockerfile .
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: extractions/setup-just@v1

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: check
run: make check
run: just check

- name: Build Docker image
run: docker build -t extrawurst/ip2country:latest -f Dockerfile .
- name: build
run: just build

- name: benchmark-iai
run: |
sudo apt-get update -y && sudo apt-get install -y valgrind
cd ip2country-bench && make bench-inside-docker
cd ip2country-bench && just bench-inside-docker
- name: benchmark
run: cargo bench
26 changes: 0 additions & 26 deletions Makefile

This file was deleted.

File renamed without changes.
28 changes: 28 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BASE_URL:="https://cdn.jsdelivr.net/npm/@ip-location-db/geo-whois-asn-country"
IP4_FILE:="geo-whois-asn-country-ipv4-num.csv"
IP6_FILE:="geo-whois-asn-country-ipv6-num.csv"

download:
curl "{{BASE_URL}}/{{IP4_FILE}}" > ip2country-service/{{IP4_FILE}}
curl "{{BASE_URL}}/{{IP6_FILE}}" > ip2country-service/{{IP6_FILE}}
cp ip2country-service/{{IP4_FILE}} ip2country-grpc/{{IP4_FILE}}
cp ip2country-service/{{IP6_FILE}} ip2country-grpc/{{IP6_FILE}}

docker-local:
docker build -t extrawurst/ip2country:latest -f Dockerfile.local .

docker-local-grpc:
docker build -t extrawurst/ip2country-grpc:latest -f Dockerfile.grpc.local .

docker-run:
docker run -it -p 5000:5000 extrawurst/ip2country:latest

test:
# run this once the container runs locally (see above)
xh 0.0.0.0:5000/172.217.16.78

build:
cargo build -p ip2country-service --release

check:
cargo clippy --workspace

0 comments on commit b31c18c

Please sign in to comment.