Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
bb19b4a
remove data from dbip_country.rs - prepared for actions build
czarte Feb 27, 2025
dd6873b
Added DBIP file generation
FinsaasGH Mar 15, 2025
e2b77c4
ci: improve GitHub Actions workflow - Replace s3-sync-action with AWS…
FinsaasGH Mar 15, 2025
3d13940
refactor: improve path resolution and code quality in generate_dbip
FinsaasGH Mar 15, 2025
e5d6dfa
ci: remove unnecessary dependencies and update generate dbip step
FinsaasGH Mar 15, 2025
5e77a80
chore: remove unused generate_dbip_country.sh script
FinsaasGH Mar 15, 2025
4ae5489
docs: update download script message to reference cargo command
FinsaasGH Mar 15, 2025
a3cdcf0
refactor: Improve generate_dbip.rs organization and efficiency
FinsaasGH Mar 15, 2025
6614f58
fix: Update dbip_country.rs paths in CI workflow to use temp directory
FinsaasGH Mar 15, 2025
0c995bb
fix: Update verification pattern for generated dbip file
FinsaasGH Mar 15, 2025
3dd52e1
ci: revert platform changes to legacy
FinsaasGH Mar 15, 2025
c0780a3
ci: update windows specific file move to use bash
FinsaasGH Mar 15, 2025
325bd40
ci: corrected verification step
FinsaasGH Mar 15, 2025
1db154c
Room for an MMDB parser
dnwiebe Mar 23, 2025
63d26da
Generating countries, rudimentary
dnwiebe Mar 23, 2025
3f7404f
parse() should produce a Countries object, instead of Vec<(String, St…
dnwiebe Mar 24, 2025
cd7e2ae
Interim commit
dnwiebe Mar 25, 2025
1a8d6b2
Must make tests self-adapting
dnwiebe Mar 28, 2025
c89dca2
No MMDB yet, but tests pass
dnwiebe Mar 30, 2025
9c32dd1
About to try bringing in an actual DBIP file
dnwiebe Apr 4, 2025
174259b
Happy-path test passing
dnwiebe Apr 7, 2025
cf1be29
MMDB parser seems to be finished
dnwiebe Apr 9, 2025
b714d97
Now MMDB parser isn't as wasteful
dnwiebe Apr 10, 2025
e9c7a64
Removed dead data
dnwiebe Apr 10, 2025
cfb1ba0
Tests all pass
dnwiebe Apr 10, 2025
eb83b48
Merge branch 'GH-788_multinode_test-review2' into GH-v2-580b
dnwiebe Apr 10, 2025
03546ed
Merge mostly complete; lots of tests pass. Maybe all of them?
dnwiebe Apr 14, 2025
d7a6ddb
One test failing. Can't figure why.
dnwiebe Apr 14, 2025
de6edae
All masq tests passing now
dnwiebe Apr 14, 2025
e7b7e3c
Multinode tests pass; one bit of code cleanup remains
dnwiebe Apr 14, 2025
d1dc3e9
All tests should be passing
dnwiebe Apr 14, 2025
199cd04
Removed dead code
dnwiebe Apr 14, 2025
4d50c3a
Little surgery on modules and imls
dnwiebe Apr 14, 2025
41456e5
Updated the CSV country list from MMDB
dnwiebe Apr 15, 2025
b67a4b3
Started GitHub Actions file for monthly downloads
dnwiebe Apr 15, 2025
07d9121
conditions for failing download and gargo run, to not continue, file …
czarte Apr 16, 2025
894deaf
Going to try out the dbip_download workflow
dnwiebe Apr 16, 2025
62fedaf
Temporary on:
dnwiebe Apr 16, 2025
2b57dc0
generate dbip_country.rs workflow and checkout dbip_country.rs from s…
czarte Apr 29, 2025
ac82b47
merge GH-788 in
czarte Apr 29, 2025
00bf223
resolved most failing tests, now failing debut_with_node_addr_not_acc…
czarte Apr 30, 2025
244c6df
fixing failing tests
czarte May 2, 2025
242dad5
comment out fetch dbip, and remove unwanted action build dbip
czarte May 2, 2025
bc80424
try to fix actions
czarte May 2, 2025
2fef65a
all countries in test dbip_country.rs
czarte May 2, 2025
38fb895
removing misstake
czarte May 2, 2025
86c259f
added checkout of read dbip_country.rs from DBIP-Experiment
czarte May 5, 2025
645fb80
new workflow: in local we work with reduced dbip, but on ci/all.sh we…
czarte May 5, 2025
7d46624
testing git pre-commit hook
czarte May 7, 2025
d7202cc
update pre-commit hook
czarte May 7, 2025
54cd278
remove checkout of dbip_country.rs from ci-matrix, it will be handled…
czarte May 7, 2025
369e541
testing pre-commit hooks changes
czarte May 12, 2025
0349cb7
testing commit hook
czarte May 12, 2025
c955825
testing pre commit hook
czarte May 12, 2025
e2d09c2
testing pre commit hook
czarte May 12, 2025
23db9a9
final polishing of pre-commit hook
czarte May 12, 2025
3127a44
addressed comments from Review
czarte May 12, 2025
eb49ebd
formatting
czarte May 12, 2025
166e706
addressing review comments, plus fix double entry of ip_country in mo…
czarte May 15, 2025
e493777
Enabled IDE tests in ip_country
dnwiebe May 15, 2025
d5c8276
Fixed module-definition problem, addressed two review comments
dnwiebe May 15, 2025
4c5d524
Weird stuff with TryFrom and From
dnwiebe May 15, 2025
0d4f36f
addressing review comments
czarte May 20, 2025
37dca71
fix ci.all condition for chekout dbip
czarte May 20, 2025
c707004
remove comments and exit in ci/all.sh
czarte May 20, 2025
0bedea4
added dbip_download github workflow (#637)
czarte May 22, 2025
0ad2d14
Master gh 580 b dbip download workflow (#639)
czarte May 23, 2025
aeae56c
Master gh 580 b dbip download workflow (#641)
czarte May 29, 2025
67929a0
generated-source from Node repo
czarte May 29, 2025
ba6daab
dbip download workflow for master
czarte May 29, 2025
697b3e5
adjust cron shedule for dbip download
czarte May 29, 2025
68c2ddb
Master gh 580 b dbip download workflow (#643)
czarte Jun 2, 2025
7659db8
Master gh 580 b dbip download workflow (#644)
czarte Jun 4, 2025
823f818
Master gh 580 b dbip download workflow (#647)
czarte Jun 5, 2025
5ef9b22
Master gh 580 b dbip download workflow (#648)
czarte Jun 6, 2025
5535b1e
Master gh 580 b dbip download workflow (#649)
czarte Jun 6, 2025
7dd6307
final touch for dbip workflow
czarte Jun 6, 2025
1f34ba3
Merge branch 'master' into GH-v2-580b-czarte
czarte Jun 6, 2025
65be2e7
git pull before ci/all.sh
czarte Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# File to check (relative to repo root)
FILENAME="ip_country/src/dbip_country.rs"

if ! git diff --cached --name-only | grep -q "^$FILENAME$"; then
exit 0
fi

# find 'Nonexistents' country in dbip_country.rs
@cat "$FILENAME" | grep '("NOEX", "Nonexistent")'
NONEXISTENT=$?

# Get local file size (staged version, not working copy)
LOCAL_SIZE=$(git ls-files --stage | grep "$FILENAME" | awk '{print $2}' | xargs git cat-file -s)

if [[ $LOCAL_SIZE -gt 1000000 || NONEXISTENT -gt 0 ]]; then
if [[ $LOCAL_SIZE -gt 1000000 ]]; then
echo "❌ Commit blocked: $FILENAME size it not dev version, we want to keep dev version under 1 MB."
echo " Local file size: $LOCAL_SIZE bytes"
fi
if [[ $NONEXISTENT -gt 0 ]]; then
echo "❌ Commit blocked: Dev file must contain '(\"NOEX\", \"Nonexistents\")' country"
fi
echo ""
echo " ⚡ Please sync the file with the remote before committing using:"
echo " git checkout HEAD -- ip_country/src/dbip_country.rs"
exit 1
fi

# All good
exit 0
62 changes: 36 additions & 26 deletions .github/workflows/ci-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Build node on ${{ matrix.target.os }}
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

Expand All @@ -36,7 +36,8 @@ jobs:
toolchain: 1.63.0
components: rustfmt, clippy
override: true
- uses: actions/cache@v3

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -45,10 +46,13 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build ${{ matrix.target.os }}
run: |
git fetch
./ci/all.sh
./ci/multinode_integration_test.sh
./ci/collect_results.sh
Expand All @@ -66,46 +70,52 @@ jobs:
df -h /Users/runner/work/Node/Node/node/target/release
deploy_to_s3:
needs: build
if: success() && (startsWith(github.head_ref, 'GH') || startsWith(github.head_ref, 'v'))
strategy:
matrix:
os: [linux, macos, windows]
runs-on: ubuntu-22.04
os: [linux, macos, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Display structure of downloaded files
run: ls -R

- name: Check artifacts exist
run: |
if [ ! -d "Node-${{ matrix.os }}/generated/bin/" ]; then
echo "Error: Build artifacts not found"
exit 1
fi

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- if: startsWith(github.head_ref, 'GH')
name: Versioned S3 Sync
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl private --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
DEST_DIR: 'Node/${{ github.head_ref }}/Node-${{ matrix.os }}'
SOURCE_DIR: 'Node-${{ matrix.os }}/generated/bin/'
run: |
aws s3 sync "Node-${{ matrix.os }}/generated/bin/" "s3://${{ secrets.AWS_S3_BUCKET }}/Node/${{ github.head_ref }}/Node-${{ matrix.os }}" \
--delete \
--no-progress \
--acl private

- if: startsWith(github.head_ref, 'v')
name: Latest S3 Sync
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl private --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-west-2'
DEST_DIR: 'Node/latest/Node-${{ matrix.os }}'
SOURCE_DIR: 'Node-${{ matrix.os }}/generated/bin/'
run: |
aws s3 sync "Node-${{ matrix.os }}/generated/bin/" "s3://${{ secrets.AWS_S3_BUCKET }}/Node/latest/Node-${{ matrix.os }}" \
--delete \
--no-progress \
--acl private

- name: Invalidate Binaries CloudFront
uses: chetan/invalidate-cloudfront-action@v2.4
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/dbip_download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Download DBIP data and generate dbip_country.rs

on:
schedule:
- cron: "0 0 3 * *" # Runs at midnight on the 3rd of every month

env:
TEMP_DIR: '/tmp'
YEAR_MONTH: '01-9999'

permissions:
contents: write

jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Download DBIP data in MMDB format
run: |
export YEAR_MONTH=$(date +%Y-%m)
echo "TEMP_DIR=$(mktemp -d)" >> $GITHUB_ENV
echo "YEAR_MONTH=$YEAR_MONTH" >> $GITHUB_ENV
cd ip_country
mkdir -p dbip-data
curl -L -o dbip-data/dbip-country-lite.mmdb.gz "https://download.db-ip.com/free/dbip-country-lite-$YEAR_MONTH.mmdb.gz"
gunzip dbip-data/dbip-country-lite.mmdb.gz

- name: Generate Rust source file
run: |
cd ip_country
cargo run < "dbip-data/dbip-country-lite.mmdb" > "$TEMP_DIR"/dbip_country.rs
ls "$TEMP_DIR"

- name: Commit and push generated file
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch
BRANCH="$(git ls-remote --exit-code --heads origin generated-source 2>/dev/null || true)"
if [[ "$BRANCH" == "" ]]
then
git checkout -B generated-source
git rm -rf .
mkdir -p ip_country/src
else
git checkout generated-source
fi
DIFF="$(diff "${TEMP_DIR}"/dbip_country.rs ip_country/src/dbip_country.rs || true)"
if [[ "$DIFF" != "" || "$BRANCH" == "" ]]
then
mv "${TEMP_DIR}"/dbip_country.rs ip_country/src/dbip_country.rs
git add ip_country/src/dbip_country.rs
git commit -m "Update generated dbip_country ${YEAR_MONTH} Rust source file" || true
git push -u origin HEAD
fi
50 changes: 47 additions & 3 deletions automap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions ci/all.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/bin/bash -xev
# Copyright (c) 2019, MASQ (https://masq.ai) and/or its affiliates. All rights reserved.
CI_DIR="$( cd "$( dirname "$0" )" && pwd )"
PARENT_DIR="$1"
export ARGV_1="$1"

ci/format.sh

export RUST_BACKTRACE=1

#if github checkout fails, you can download csv database from db-ip.com and convert it locally by cargo run ip_country
if [[ $GITHUB_ACTIONS || "$ARGV_1" == "dbip" ]]; then
git checkout origin/generated-source -- ip_country/src/dbip_country.rs
ls -la ip_country/src/dbip_country.rs
fi
if [[ -z "${GITHUB_ACTIONS}" ]]; then
bash ./install-hooks.sh
fi
# Remove these two lines to slow down the build
which sccache || cargo install --version 0.4.1 sccache || echo "Skipping sccache installation" # Should do significant work only once
#export CARGO_TARGET_DIR="$CI_DIR/../cargo-cache"
Expand All @@ -18,19 +25,19 @@ export RUSTFLAGS="-D warnings -Anon-snake-case"
echo "*********************************************************************************************************"
echo "*** MASQ_LIB HEAD ***"
cd "$CI_DIR/../masq_lib"
ci/all.sh "$PARENT_DIR"
ci/all.sh
echo "*** MASQ_LIB TAIL ***"
echo "*********************************************************************************************************"
echo "*********************************************************************************************************"
echo "*** NODE HEAD ***"
cd "$CI_DIR/../node"
ci/all.sh "$PARENT_DIR"
ci/all.sh
echo "*** NODE TAIL ***"
echo "*********************************************************************************************************"
echo "*********************************************************************************************************"
echo "*** DNS UTILITY HEAD ***"
cd "$CI_DIR/../dns_utility"
ci/all.sh "$PARENT_DIR"
ci/all.sh
echo "*** DNS UTILITY TAIL ***"
echo "*********************************************************************************************************"
echo "*********************************************************************************************************"
Expand All @@ -42,13 +49,12 @@ echo "**************************************************************************
echo "*********************************************************************************************************"
echo "*** AUTOMAP HEAD ***"
cd "$CI_DIR/../automap"
ci/all.sh "$PARENT_DIR"
ci/all.sh
echo "*** AUTOMAP TAIL ***"
echo "*********************************************************************************************************"
echo "*********************************************************************************************************"
echo "*** IP COUNTRY HEAD ***"
cd "$CI_DIR/../ip_country"
ci/all.sh "$PARENT_DIR"
ci/all.sh
echo "*** IP COUNTRY TAIL ***"
echo "*********************************************************************************************************"

Loading
Loading