build: expose generic cargo build arguments (#43)

* build: expose generic cargo build arguments

* fix: satisfy clippy after build argument cleanup

* ci: run clippy independently and remove feature checks

* ci: avoid duplicate push checks for pull requests

* ci: deduplicate branch push and pull request runs

* ci: isolate push and pull request concurrency groups
pull/370/head
zijiren 2 months ago committed by GitHub
parent a9e43f399b
commit bd9bf2bcee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,8 +11,8 @@ on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
@ -38,16 +38,17 @@ jobs:
- name: Check formatting
run: make fmt-check
# Build
build:
name: Build
# Run Clippy lints independently from the test jobs.
clippy:
name: Clippy Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install protobuf compiler
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
@ -55,11 +56,13 @@ jobs:
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Build
run: make build-workspace
- name: Run Clippy
timeout-minutes: 60
run: make clippy-check
proto-freshness:
name: Proto Freshness
# Build
build:
name: Build
runs-on: ubuntu-latest
steps:
@ -74,12 +77,11 @@ jobs:
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Check generated proto artifacts
run: make proto-freshness
- name: Build
run: make build-workspace
# SQLx offline metadata
sqlx-offline:
name: SQLx Offline Check
proto-freshness:
name: Proto Freshness
runs-on: ubuntu-latest
steps:
@ -94,40 +96,13 @@ jobs:
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Check SQLx offline metadata
run: make check-all-targets
- name: Check generated proto artifacts
run: make proto-freshness
feature-check:
name: Feature Check (${{ matrix.name }})
# SQLx offline metadata
sqlx-offline:
name: SQLx Offline Check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: synctv-no-default-features
target: feature-check
args: --no-default-features
- name: synctv-tls-aws-lc-webpki
target: feature-check
args: --no-default-features --features tls-aws-lc,tls-webpki-roots
- name: synctv-tls-aws-lc-native
target: feature-check
args: --no-default-features --features tls-aws-lc,tls-native-roots
- name: synctv-tls-ring-webpki
target: feature-check
args: --no-default-features --features tls-ring,tls-webpki-roots
- name: synctv-tls-ring-native
target: feature-check
args: --no-default-features --features tls-ring,tls-native-roots
- name: synctv-production-default
target: feature-check
args: --features tls-native-roots
- name: synctv-openapi
target: feature-check
args: --features openapi
- name: key-crates-tls-ring-webpki
target: feature-check-key-crates-tls-ring-webpki
args: ""
steps:
- uses: actions/checkout@v5
@ -141,10 +116,8 @@ jobs:
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Run feature check
env:
FEATURE_CHECK_ARGS: ${{ matrix.args }}
run: make ${{ matrix.target }}
- name: Check SQLx offline metadata
run: make check-all-targets
# Test non-ignored cases
test-default:
@ -162,8 +135,6 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
@ -187,10 +158,6 @@ jobs:
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Run clippy
timeout-minutes: 60
run: make clippy-check
- name: Run non-ignored tests with nextest
timeout-minutes: 60
run: make nextest-default

@ -10,8 +10,8 @@ on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
actions: read

@ -11,6 +11,10 @@ on:
- cron: '0 0 * * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read

@ -14,8 +14,8 @@ on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read

@ -30,8 +30,8 @@ on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
permissions:
contents: read

@ -27,9 +27,8 @@ ENV SQLX_OFFLINE=true
# fully explicit feature set.
ARG SYNCTV_BUILD_NO_DEFAULT_FEATURES=false
ARG SYNCTV_BUILD_FEATURES="k8s,mimalloc,openapi"
ARG SYNCTV_BUILD_JOBS=1
ARG SYNCTV_CARGO_BUILD_ARGS=""
ARG TARGETARCH
ENV CARGO_BUILD_JOBS=$SYNCTV_BUILD_JOBS
# Copy entire source tree
COPY . .
@ -40,6 +39,9 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,id=synctv-target-${TARGETARCH},target=/app/target,sharing=locked \
build_flags="--release --bin synctv"; \
if [ -n "$SYNCTV_CARGO_BUILD_ARGS" ]; then \
build_flags="$build_flags $SYNCTV_CARGO_BUILD_ARGS"; \
fi; \
if [ "$SYNCTV_BUILD_NO_DEFAULT_FEATURES" = "true" ]; then \
build_flags="$build_flags --no-default-features"; \
fi; \

@ -64,7 +64,7 @@ pub async fn apple_app_site_association(
.unwrap_or_default();
let document = apple_app_site_association_document(
app_ids,
oauth2_app_link_paths(&allowed_redirect_urls, host),
&oauth2_app_link_paths(&allowed_redirect_urls, host),
);
Ok((
[(header::CACHE_CONTROL, ASSOCIATION_CACHE_CONTROL)],
@ -74,7 +74,7 @@ pub async fn apple_app_site_association(
fn apple_app_site_association_document(
app_ids: Vec<String>,
callback_paths: Vec<String>,
callback_paths: &[String],
) -> AppleAppSiteAssociation {
AppleAppSiteAssociation {
applinks: AppleAppLinks {
@ -83,7 +83,7 @@ fn apple_app_site_association_document(
.iter()
.map(|app_id| AppleAppLinkDetails {
app_id: app_id.clone(),
paths: callback_paths.clone(),
paths: callback_paths.to_vec(),
})
.collect(),
},
@ -171,7 +171,7 @@ mod tests {
);
let document = apple_app_site_association_document(
vec!["85KBWFQ6F6.org.synctv.app".to_string()],
paths,
&paths,
);
assert_eq!(
serde_json::to_value(document).expect("association document should serialize"),

@ -364,16 +364,10 @@ impl std::str::FromStr for CorsAllowedOrigins {
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(transparent)]
pub struct OAuth2AllowedRedirectUrls(pub Vec<String>);
impl Default for OAuth2AllowedRedirectUrls {
fn default() -> Self {
Self(Vec::new())
}
}
impl fmt::Display for OAuth2AllowedRedirectUrls {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&serde_json::to_string(&self.0).map_err(|_| fmt::Error)?)

@ -288,7 +288,6 @@ async fn oauth2_service_with_provider_signup(
OAuth2ServiceRuntime {
runtime_settings_store: Some(runtime_settings_store),
user_service: Some(Arc::new(create_user_service(pool))),
..OAuth2ServiceRuntime::default()
},
)
.checked("OAuth2 service should initialize")

Loading…
Cancel
Save