1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Automate schema updates

This commit is contained in:
Quentin Gliech
2022-11-07 11:35:06 +01:00
parent 13c7d2772f
commit 3f56031795
7 changed files with 72 additions and 10 deletions

View File

@ -74,6 +74,33 @@ jobs:
run: cargo fmt --all -- --check
check-schema:
name: Check schema
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install toolchain
run: |
rustup toolchain install stable
rustup default stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Update the schemas
run: sh ./misc/update-schemas.sh
- name: Check that the workspace is clean
run: |
[[ -z $(git status -s) ]]
clippy:
name: Run Clippy
needs: [rustfmt, opa-lint]
@ -362,3 +389,22 @@ jobs:
env:
TAGS: "${{ steps.meta.outputs.tags }} ${{ steps.meta-debug.outputs.tags }}"
COSIGN_EXPERIMENTAL: 1
tests-done:
name: Tests done
if: ${{ always() }}
needs:
- opa-lint
- rustfmt
- clippy
- check-schema
- test
- coverage
- build-image
runs-on: ubuntu-latest
steps:
- uses: matrix-org/done-action@v2
with:
needs: ${{ toJSON(needs) }}

View File

@ -37,5 +37,9 @@ mas-keystore = { path = "../keystore" }
mas-iana = { path = "../iana" }
mas-email = { path = "../email" }
[features]
native-roots = ["mas-email/native-roots"]
webpki-roots = ["mas-email/webpki-roots"]
[[bin]]
name = "schema"

View File

@ -23,3 +23,7 @@ mas-http = { path = "../http", features = ["aws-sdk", "client"] }
version = "0.10.1"
default-features = false
features = ["tokio1-rustls-tls", "hostname", "builder", "tracing", "pool", "smtp-transport", "sendmail-transport"]
[features]
native-roots = ["mas-http/native-roots"]
webpki-roots = ["mas-http/webpki-roots"]

View File

@ -13,5 +13,9 @@ tokio-stream = "0.1.11"
mas-axum-utils = { path = "../axum-utils" }
[features]
native-roots = ["mas-axum-utils/native-roots"]
webpki-roots = ["mas-axum-utils/webpki-roots"]
[[bin]]
name = "schema"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#[cfg(feature = "axum")]
#[cfg(any(feature = "axum", feature = "aws-sdk"))]
use std::borrow::Cow;
#[cfg(feature = "axum")]

13
misc/update-schemas.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -eu
export SQLX_OFFLINE=1
BASE_DIR="$(dirname "$0")/.."
CONFIG_SCHEMA="${BASE_DIR}/docs/config.schema.json"
GRAPHQL_SCHEMA="${BASE_DIR}/crates/graphql/schema.graphql"
set -x
# XXX: we shouldn't have to specify this feature
cargo run -p mas-config --features webpki-roots > "${CONFIG_SCHEMA}"
cargo run -p mas-graphql --features webpki-roots > "${GRAPHQL_SCHEMA}"

View File

@ -1,9 +0,0 @@
# Disable wasmtime cache by default in the Docker image, because the rootfs is likely to be read-only
[cache]
enabled = false
# A directory which exists *must* be specified even though the cache is
# disabled, else wasmtime will try to create it, which might fail if the rootfs
# is mounted as read-only
directory = "/tmp"