-
Notifications
You must be signed in to change notification settings - Fork 51
ci(automation): enhance repository automation and code quality workflows (#320) #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| name: "Commit & PR Title Validation" | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - edited | ||
| - synchronize | ||
| - reopened | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| validate-pr-title: | ||
| name: Validate PR Title & Format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate PR Title Format | ||
| uses: amannn/action-semantic-pull-request@v5 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| types: | | ||
| feat | ||
| fix | ||
| docs | ||
| style | ||
| refactor | ||
| perf | ||
| test | ||
| chore | ||
| ci | ||
| build | ||
| requireScope: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| name: "Release Notes Generator" | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| generate-release-notes: | ||
| name: Generate Release Draft & Notes | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Generate Release Notes | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| generate_release_notes: true | ||
| draft: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| name: "Rust CI" | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - /^release-.*$/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| paths: | ||
| - computer-rust/** | ||
| - .github/workflows/rust-ci.yml | ||
| pull_request: | ||
| paths: | ||
| - computer-rust/** | ||
| - .github/workflows/rust-ci.yml | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: computer-rust | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| rust-check: | ||
| name: Rust Code Quality & Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy, rustfmt | ||
|
|
||
| - name: Cache Cargo dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/bin/ | ||
| ~/.cargo/registry/index/ | ||
| ~/.cargo/registry/cache/ | ||
| ~/.cargo/git/db/ | ||
| computer-rust/target/ | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('computer-rust/Cargo.toml') }} | ||
| restore-keys: ${{ runner.os }}-cargo- | ||
|
|
||
| - name: Check code formatting | ||
| run: cargo fmt --check | ||
|
|
||
| - name: Run clippy lints | ||
| run: cargo clippy --all-targets -- -D warnings | ||
|
|
||
| - name: Run tests | ||
| run: cargo test --all-targets --verbose | ||
|
|
||
| - name: Build release library | ||
| run: cargo build --release | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| [package] | ||
| name = "hugegraph-computer-rust" | ||
| version = "1.5.0" | ||
| edition = "2021" | ||
| authors = ["Apache HugeGraph Authors <dev@hugegraph.apache.org>"] | ||
| license = "Apache-2.0" | ||
| description = "High-performance Rust graph computing kernels for HugeGraph Computer and Vermeer" | ||
| repository = "https://github.com/apache/hugegraph-computer" | ||
|
|
||
| [lib] | ||
| name = "hugegraph_computer_rust" | ||
| crate-type = ["cdylib", "staticlib", "rlib"] | ||
|
|
||
| [dependencies] | ||
| libc = "0.2" | ||
|
|
||
| [dev-dependencies] | ||
| criterion = "0.5" | ||
|
|
||
| [[bench]] | ||
| name = "kernel_bench" | ||
| harness = false | ||
|
|
||
| [profile.release] | ||
| opt-level = 3 | ||
| lto = true | ||
| codegen-units = 1 | ||
| panic = "abort" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| use criterion::{criterion_group, criterion_main, Criterion}; | ||
| use hugegraph_computer_rust::fixtures::dataset::GraphFixture; | ||
| use hugegraph_computer_rust::kernel::pagerank::PageRankKernel; | ||
| use hugegraph_computer_rust::kernel::sssp::SsspKernel; | ||
|
|
||
| fn bench_pagerank(c: &mut Criterion) { | ||
| let fixture = GraphFixture::synthetic_powerlaw(1000, 10); | ||
| let csr = fixture.to_csr(); | ||
| let kernel = PageRankKernel::new(0.85, 20, 1e-4); | ||
|
|
||
| c.bench_function("pagerank_1k_vertices", |b| { | ||
| b.iter(|| kernel.compute(&csr)) | ||
| }); | ||
| } | ||
|
|
||
| fn bench_sssp(c: &mut Criterion) { | ||
| let fixture = GraphFixture::synthetic_powerlaw(1000, 10); | ||
| let csr = fixture.to_csr(); | ||
|
|
||
| c.bench_function("sssp_1k_vertices", |b| { | ||
| b.iter(|| SsspKernel::compute(&csr, 0)) | ||
| }); | ||
| } | ||
|
|
||
| criterion_group!(benches, bench_pagerank, bench_sssp); | ||
| criterion_main!(benches); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef HUGEGRAPH_COMPUTER_RUST_C_API_H | ||
| #define HUGEGRAPH_COMPUTER_RUST_C_API_H | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
| #include <stdbool.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| typedef struct GraphHandle GraphHandle; | ||
|
|
||
| /** | ||
| * Creates a new GraphHandle instance with the specified number of vertices. | ||
| */ | ||
| GraphHandle* computer_graph_create(uint32_t num_vertices); | ||
|
|
||
| /** | ||
| * Adds a directed edge from src to dst with an optional weight. | ||
| */ | ||
| int32_t computer_graph_add_edge(GraphHandle* handle, uint32_t src, uint32_t dst, double weight); | ||
|
|
||
| /** | ||
| * Finalizes graph topology into Compressed Sparse Row (CSR) structure. | ||
| */ | ||
| int32_t computer_graph_finalize(GraphHandle* handle); | ||
|
|
||
| /** | ||
| * Computes PageRank on the CSR graph structure. | ||
| * Results array must be allocated by caller with capacity >= num_vertices. | ||
| */ | ||
| int32_t computer_graph_compute_pagerank( | ||
| const GraphHandle* handle, | ||
| double damping_factor, | ||
| uint32_t max_iterations, | ||
| double tolerance, | ||
| double* out_scores, | ||
| uint32_t out_capacity | ||
| ); | ||
|
|
||
| /** | ||
| * Computes Single Source Shortest Path (SSSP) starting from source_vertex. | ||
| * Results array must be allocated by caller with capacity >= num_vertices. | ||
| */ | ||
| int32_t computer_graph_compute_sssp( | ||
| const GraphHandle* handle, | ||
| uint32_t source_vertex, | ||
| double* out_distances, | ||
| uint32_t out_capacity | ||
| ); | ||
|
|
||
| /** | ||
| * Frees the GraphHandle resources. | ||
| */ | ||
| void computer_graph_free(GraphHandle* handle); | ||
|
|
||
| /** | ||
| * Returns the version string of the Rust kernel library. | ||
| */ | ||
| const char* computer_kernel_version(void); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* HUGEGRAPH_COMPUTER_RUST_C_API_H */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v*tags, while the repository's existing release tags use the1.0.0/1.5.0/1.7.0form. A normal version tag will not run this workflow and will not produce draft release notes. Align the trigger with the repository's release convention or update the release process consistently.