chore: add docker and ci

This commit is contained in:
2026-06-16 14:49:22 +02:00
parent ce065c932a
commit ae454a0b4f
5 changed files with 219 additions and 0 deletions

50
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Docker
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Select Docker platforms
id: docker-platforms
shell: bash
run: |
if [ "${ACT:-}" = "true" ] || [ "${GITEA_ACTIONS:-}" = "true" ]; then
echo "platforms=linux/amd64" >> "$GITHUB_OUTPUT"
else
echo "platforms=linux/amd64,linux/arm64" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
if: ${{ steps.docker-platforms.outputs.platforms != 'linux/amd64' }}
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
# Production hardening: add dependency and image scanning before publishing,
# for example cargo-audit plus a container scanner such as Sysdig or Trivy.
- name: Build multi-arch image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
context: .
platforms: ${{ steps.docker-platforms.outputs.platforms }}
push: false
build-args: |
GIT_SHA=${{ github.sha }}
cache-from: type=gha,scope=docker-multiarch
cache-to: type=gha,mode=max,scope=docker-multiarch

View File

@@ -0,0 +1,30 @@
name: External contracts
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_PROFILE_TEST_DEBUG: line-tables-only
CARGO_INCREMENTAL: 0
jobs:
external-contracts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
# These tests intentionally call real third-party APIs. Unit/integration
# tests mock providers, but a nightly contract check catches external API
# drift that would otherwise only appear at runtime.
- name: Run external contract tests
run: cargo test --locked --test external_contract -- --ignored --test-threads=1

47
.github/workflows/rust.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Rust
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_PROFILE_DEV_DEBUG: line-tables-only
CARGO_PROFILE_TEST_DEBUG: line-tables-only
CARGO_INCREMENTAL: 0
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: cargo fmt
run: cargo fmt --all --check
- name: cargo clippy
run: cargo clippy --locked --all-targets -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: cargo test
run: cargo test --locked