Skip to content

Commit 7aaf44a

Browse files
committed
Merge branch 'main' into kurotych/speedtest-bounds
2 parents 9b71d21 + bd88e65 commit 7aaf44a

File tree

182 files changed

+3459
-5517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+3459
-5517
lines changed

.github/scripts/make_debian.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ gem install dotenv -v 2.8.1
108108
gem install fpm -v 1.14.2 # current as of 2022-11-08
109109
echo "ruby deps installed"
110110

111-
for config_path in $( find . -name 'settings-template.toml' )
111+
for config_path in "reward_index" "price" "ingest" "iot_config" "iot_packet_verifier" "iot_verifier" "poc_entropy"
112112
do
113113
oracle=$(echo $config_path | sed -E 's!\./([^/]+)/.+$!\1!' | sed -E 's!_!-!g')
114114

@@ -128,4 +128,4 @@ do
128128
-F "package[distro_version_id]=210" \
129129
-F "package[package_file]=@$deb" \
130130
https://packagecloud.io/api/v1/repos/helium/oracles/packages.json
131-
done
131+
done

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818
RUST_BACKTRACE: short
1919
RUSTFLAGS: "-D warnings"
2020
RUSTUP_MAX_RETRIES: 10
21+
AWS_LC_SYS_CMAKE_BUILDER: 1
2122

2223
jobs:
2324

.github/workflows/DockerCI.yml

Lines changed: 71 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -8,155 +8,114 @@ on:
88
tags: ["*"]
99
workflow_dispatch:
1010

11-
env:
12-
TARGET: base
11+
permissions:
12+
contents: read
13+
packages: write
1314

1415
jobs:
15-
16+
compute-base-build-tag:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
image_tag: ${{ steps.out.outputs.tag }}
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v4
23+
- name: Create Tag
24+
id: out
25+
run: echo "tag=${{ hashFiles('Dockerfile','rust-toolchain.toml') }}" >> "$GITHUB_OUTPUT"
1626
build-base:
27+
needs: compute-base-build-tag
1728
runs-on: ubuntu-latest
1829
steps:
1930
- name: Checkout Repository
2031
uses: actions/checkout@v4
21-
2232
- name: Log in to GitHub Container Registry
2333
uses: docker/login-action@v3
2434
with:
2535
registry: ghcr.io
2636
username: ${{ github.actor }}
2737
password: ${{ secrets.GITHUB_TOKEN }}
28-
2938
- name: Pull Cached Base Image
30-
id: check-image
31-
env:
32-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
3339
run: |
34-
if docker pull ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG; then
40+
if docker pull ghcr.io/${{ github.repository }}/base:${{ needs.compute-base-build-tag.outputs.image_tag }}; then
3541
echo "CACHE_HIT=true" >> $GITHUB_ENV
3642
else
3743
echo "CACHE_HIT=false" >> $GITHUB_ENV
3844
fi
39-
4045
- name: Set up Docker Buildx
4146
if: env.CACHE_HIT == 'false'
4247
uses: docker/setup-buildx-action@v3
43-
4448
- name: Build and Push Base Image (if not cached)
4549
if: env.CACHE_HIT == 'false'
46-
env:
47-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
48-
run: |
49-
docker build --target $TARGET -t ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG -f Dockerfile .
50-
docker push ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG
51-
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
file: Dockerfile
54+
target: base
55+
push: true
56+
tags: ghcr.io/${{ github.repository }}/base:${{ needs.compute-base-build-tag.outputs.image_tag }}
5257
fmt:
53-
needs: build-base
58+
needs: [compute-base-build-tag, build-base]
5459
runs-on: ubuntu-latest
60+
container:
61+
image: ghcr.io/${{ github.repository }}/base:${{ needs.compute-base-build-tag.outputs.image_tag }}
62+
options: --user 1001:1001
5563
concurrency:
5664
group: ${{ github.workflow }}-${{ github.ref }}-fmt
5765
cancel-in-progress: true
5866
steps:
5967
- name: Checkout Repository
6068
uses: actions/checkout@v4
61-
62-
- name: Log in to GitHub Container Registry
63-
uses: docker/login-action@v3
64-
with:
65-
registry: ghcr.io
66-
username: ${{ github.actor }}
67-
password: ${{ secrets.GITHUB_TOKEN }}
68-
69-
- name: Pull Base Image
70-
env:
71-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
72-
run: docker pull ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG
73-
7469
- name: Check formatting
75-
env:
76-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
77-
run: |
78-
docker run \
79-
--rm \
80-
-v $PWD:/app \
81-
-w /app \
82-
ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG \
83-
cargo fmt -- --check
84-
70+
run: cargo fmt -- --check
8571
clippy:
86-
needs: build-base
72+
needs: [compute-base-build-tag, build-base]
8773
runs-on: ubuntu-latest
74+
container:
75+
image: ghcr.io/${{ github.repository }}/base:${{ needs.compute-base-build-tag.outputs.image_tag }}
76+
options: --user 1001:1001
8877
concurrency:
8978
group: ${{ github.workflow }}-${{ github.ref }}-clippy
9079
cancel-in-progress: true
9180
steps:
9281
- name: Checkout Repository
9382
uses: actions/checkout@v4
94-
9583
- name: Cache Cargo Target Directory
9684
uses: actions/cache@v4
97-
env:
98-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
9985
with:
10086
path: target
101-
key: clippy-${{ env.TARGET }}-${{ env.IMAGE_TAG }}-${{ hashFiles('**/Cargo.lock') }}
87+
key: clippy-base-${{ needs.compute-base-build-tag.outputs.image_tag }}-${{ hashFiles('**/Cargo.lock') }}
10288
restore-keys: |
103-
clippy-${{ env.TARGET }}-${{ env.IMAGE_TAG }}-
104-
105-
- name: Log in to GitHub Container Registry
106-
uses: docker/login-action@v3
107-
with:
108-
registry: ghcr.io
109-
username: ${{ github.actor }}
110-
password: ${{ secrets.GITHUB_TOKEN }}
111-
112-
- name: Pull Base Image
113-
env:
114-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
115-
run: docker pull ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG
116-
89+
clippy-base-${{ needs.compute-base-build-tag.outputs.image_tag }}-
11790
- name: Clippy
118-
env:
119-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
120-
run: |
121-
docker run \
122-
--rm \
123-
-v $PWD:/app \
124-
-v $PWD/target:/app/target \
125-
-w /app \
126-
ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG \
127-
cargo clippy --all-targets -- -Dclippy::all -D warnings
128-
129-
- name: Fix Permissions for Caching
130-
run: sudo chown -R $(whoami):$(whoami) target
131-
91+
run: cargo clippy --all-targets -- -Dclippy::all -D warnings
13292
generate-matrix:
13393
runs-on: ubuntu-latest
13494
outputs:
13595
matrix: ${{ steps.get-matrix.outputs.matrix }}
13696
steps:
13797
- name: Checkout Code
13898
uses: actions/checkout@v4
139-
14099
- name: Restore Cached Matrix
141100
id: cache-matrix
142101
uses: actions/cache@v4
143102
with:
144103
path: matrix.json
145104
key: matrix-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
146-
147105
- name: Extract Cargo Workspace Members (if not cached)
148106
if: steps.cache-matrix.outputs.cache-hit != 'true'
149107
run: |
150108
set -e
151109
cargo metadata --format-version=1 | jq -c '[.workspace_members[] | split("#")[0] | split("/") | last | gsub("_"; "-") | select(. != "metrics")]' > matrix.json
152-
153110
- name: Save Matrix to Output
154111
id: get-matrix
155112
run: echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
156-
157113
tests:
158-
needs: [generate-matrix, build-base]
114+
needs: [compute-base-build-tag, build-base, generate-matrix]
159115
runs-on: ubuntu-latest
116+
container:
117+
image: ghcr.io/${{ github.repository }}/base:${{ needs.compute-base-build-tag.outputs.image_tag }}
118+
options: --user 1001:1001
160119
strategy:
161120
fail-fast: false
162121
matrix:
@@ -186,43 +145,48 @@ jobs:
186145
steps:
187146
- name: Checkout Repository
188147
uses: actions/checkout@v4
189-
190148
- name: Cache Cargo Target Directory
191149
# Anything above 4min run
192-
if: contains('["boost-manager", "ingest", "iot-config", "iot-packet-verifier", "iot-verifier", "mobile-packet-verifier", "mobile-verifier", "price", "solana"]', matrix.package)
150+
if: contains('["ingest", "iot-config", "iot-packet-verifier", "iot-verifier", "mobile-packet-verifier", "mobile-verifier", "price", "solana"]', matrix.package)
193151
uses: actions/cache@v4
194-
env:
195-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
196152
with:
197153
path: target
198-
key: tests-${{ matrix.package }}-${{ env.TARGET }}-${{ env.IMAGE_TAG }}-${{ hashFiles('**/Cargo.lock') }}
154+
key: tests-${{ matrix.package }}-base-${{ needs.compute-base-build-tag.outputs.image_tag }}-${{ hashFiles('**/Cargo.lock') }}
199155
restore-keys: |
200-
tests-${{ matrix.package }}-${{ env.TARGET }}-${{ env.IMAGE_TAG }}-
201-
156+
tests-${{ matrix.package }}-base-${{ needs.compute-base-build-tag.outputs.image_tag }}-
157+
- name: Run tests
158+
env:
159+
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
160+
AWSLOCAL_ENDPOINT: "http://localstack:4566"
161+
run: cargo test -p ${{ matrix.package }} -- --include-ignored
162+
build-image:
163+
if: startsWith(github.ref, 'refs/tags/')
164+
needs: [fmt, clippy, tests]
165+
runs-on: ubuntu-latest
166+
strategy:
167+
matrix:
168+
package: ["ingest","mobile-config","mobile-packet-verifier","mobile-verifier","price","reward-index"]
169+
concurrency:
170+
group: ${{ github.workflow }}-${{ github.ref }}-build-image-${{ matrix.package }}
171+
cancel-in-progress: true
172+
steps:
173+
- name: Checkout Repository
174+
uses: actions/checkout@v4
202175
- name: Log in to GitHub Container Registry
203176
uses: docker/login-action@v3
204177
with:
205178
registry: ghcr.io
206179
username: ${{ github.actor }}
207180
password: ${{ secrets.GITHUB_TOKEN }}
208-
209-
- name: Pull Base Image
210-
env:
211-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
212-
run: docker pull ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG
213-
214-
- name: Run tests
215-
env:
216-
IMAGE_TAG: ${{ hashFiles('Dockerfile', 'rust-toolchain.toml') }}
217-
run: |
218-
docker run \
219-
--rm \
220-
--network=host \
221-
-e DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres" \
222-
-v $PWD:/app \
223-
-w /app \
224-
ghcr.io/${{ github.repository }}/$TARGET:$IMAGE_TAG \
225-
cargo test -p ${{ matrix.package }} -- --include-ignored
226-
227-
- name: Fix Permissions for Caching
228-
run: sudo chown -R $(whoami):$(whoami) target
181+
- name: Set up Docker Buildx
182+
uses: docker/setup-buildx-action@v3
183+
- name: Build and Push Base Image
184+
uses: docker/build-push-action@v6
185+
with:
186+
context: .
187+
file: Dockerfile
188+
target: runner
189+
push: true
190+
tags: ghcr.io/${{ github.repository }}/${{ matrix.package }}:${{ github.ref_name }}
191+
build-args: |
192+
PACKAGE=${{ matrix.package }}

0 commit comments

Comments
 (0)