Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into map/download-data-sets
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed May 17, 2024
2 parents 902e62f + 79c8dae commit 8cae6d0
Show file tree
Hide file tree
Showing 60 changed files with 757 additions and 522 deletions.
7 changes: 6 additions & 1 deletion .github/scripts/make_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@ run_fpm()
sudo apt update
sudo apt install --yes ruby
sudo gem install fpm -v 1.14.2 # current as of 2022-11-08
echo "ruby deps installed"

for config_path in $( find . -name 'settings-template.toml' )
do
oracle=$(echo $config_path | sed -E 's!\./([^/]+)/.+$!\1!' | sed -E 's!_!-!g')


echo "starting $oracle $config_path $VERSION"
write_unit_template $oracle
echo "write_unit_template $oracle done"
write_prepost_template $oracle
echo "write_prepost_template $oracle done"
run_fpm $oracle $config_path $VERSION
echo "run_fpm $oracle done"
done

for deb in /tmp/*.deb
Expand Down
201 changes: 201 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: ["main"]
tags: ["*"]

env:
CARGO_INCREMENTAL: 0 # this setting is automatically applied by rust-cache but documented here for explicitness
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10

jobs:

build:
runs-on: oracles-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust install
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: cargo build --all --tests

fmt:
runs-on: oracles-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-fmt
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust install
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
run: cargo fmt -- --check

clippy:
runs-on: oracles-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-clippy
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust install
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Clippy
run: cargo clippy --all-targets -- -Dclippy::all -D warnings

tests-postgres:
needs: build
runs-on: oracles-20.04
strategy:
fail-fast: false
matrix:
package: [boost-manager,iot-config,iot-packet-verifier,iot-verifier,mobile-config,mobile-verifier]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-tests-postgres-${{ matrix.package }}
cancel-in-progress: true
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust install
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run unit and integration tests
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres"
run: cargo test -p ${{ matrix.package }} -- --include-ignored

tests:
needs: build
runs-on: oracles-20.04
strategy:
fail-fast: false
matrix:
package: [file-store,ingest,mobile-packet-verifier,reward-scheduler,task-manager]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-tests-${{ matrix.package }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust install
uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run unit and integration tests
run: cargo test -p ${{ matrix.package }} -- --include-ignored

build-release:
needs: [fmt, clippy, tests, tests-postgres]
runs-on: oracles-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build-release
cancel-in-progress: true
if: contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable

- name: Install protoc
run: sudo apt-get install -y protobuf-compiler

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build Release
run: cargo build --all --release

- name: Debian packaging
env:
PACKAGECLOUD_API_KEY: ${{ secrets.PACKAGECLOUD_API_KEY }}
run: |
chmod +x ./.github/scripts/make_debian.sh
./.github/scripts/make_debian.sh
71 changes: 0 additions & 71 deletions .github/workflows/rust.yml

This file was deleted.

13 changes: 13 additions & 0 deletions Cargo.lock

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

Loading

0 comments on commit 8cae6d0

Please sign in to comment.