From b31c18c06acc837dec94472bba189527d45e0eeb Mon Sep 17 00:00:00 2001 From: extrawurst <776816+extrawurst@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:46:52 +0100 Subject: [PATCH] use just and build release on ci (#5) --- .github/workflows/cd.yaml | 4 +++- .github/workflows/ci.yaml | 10 +++++---- Makefile | 26 ----------------------- ip2country-bench/{Makefile => justfile} | 0 justfile | 28 +++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 31 deletions(-) delete mode 100644 Makefile rename ip2country-bench/{Makefile => justfile} (100%) create mode 100644 justfile diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 5e4cce4..7b7cc28 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -11,6 +11,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - uses: extractions/setup-just@v1 + - name: Login to Docker Hub run: | docker login \ @@ -18,7 +20,7 @@ jobs: -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 . diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ccba10d..400b837 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/Makefile b/Makefile deleted file mode 100644 index e07c79e..0000000 --- a/Makefile +++ /dev/null @@ -1,26 +0,0 @@ - -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 - -check: - cargo clippy --workspace diff --git a/ip2country-bench/Makefile b/ip2country-bench/justfile similarity index 100% rename from ip2country-bench/Makefile rename to ip2country-bench/justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..afb5f8a --- /dev/null +++ b/justfile @@ -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