From e7256b64d6088ca7f3f9904ad7385fb4a400f6c7 Mon Sep 17 00:00:00 2001 From: Kai Hudalla Date: Mon, 17 Feb 2025 13:28:17 +0100 Subject: [PATCH] [#232] Replace local workflows Use references to assets from the uProtocol CI/CD repo instead of keeping local copies of workflows/actions. --- .github/actions/run-oft/README.md | 19 ----- .github/actions/run-oft/action.yaml | 58 -------------- .github/workflows/coverage.yaml | 83 --------------------- .github/workflows/license-report.yaml | 58 -------------- .github/workflows/nightly.yaml | 13 ++-- .github/workflows/release.yaml | 11 ++- .github/workflows/requirements-tracing.yaml | 58 -------------- .github/workflows/test-featurematrix.yaml | 79 -------------------- .github/workflows/verify-latest-deps.yaml | 41 ---------- .github/workflows/verify-msrv.yaml | 40 ---------- .github/workflows/x-build.yaml | 69 ----------------- 11 files changed, 14 insertions(+), 515 deletions(-) delete mode 100644 .github/actions/run-oft/README.md delete mode 100644 .github/actions/run-oft/action.yaml delete mode 100644 .github/workflows/coverage.yaml delete mode 100644 .github/workflows/license-report.yaml delete mode 100644 .github/workflows/requirements-tracing.yaml delete mode 100644 .github/workflows/test-featurematrix.yaml delete mode 100644 .github/workflows/verify-latest-deps.yaml delete mode 100644 .github/workflows/verify-msrv.yaml delete mode 100644 .github/workflows/x-build.yaml diff --git a/.github/actions/run-oft/README.md b/.github/actions/run-oft/README.md deleted file mode 100644 index dcf6639..0000000 --- a/.github/actions/run-oft/README.md +++ /dev/null @@ -1,19 +0,0 @@ -Run OpenFastTrace CLI's `trace` command on the local `up-rust` workspace and uploads the report as a workflow artifact. - -Considers all (relevant) specification documents from the `up-spec` submodule and all -implementation and documentation artifacts contained in the `up-rust` repository. - -The action uses the [standard OpenFastTrace Action](https://github.com/itsallcode/openfasttrace-github-action) for running OpenFastTrace (OFT). - -# Inputs - -| Name | Description | -| :-------------- | :---------------------------------------------------------------------------------------------------- | -| `file-patterns` | A whitespace separated list of glob patterns which specify the files to include in the OFT trace run. | - -# Outputs - -| Name | Description | -| :------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `oft-exit-code` | 0: OFT has run successfully and all specification items are covered
> 1: OFT has either failed to run or at least one specification item is not covered. | -| `tracing-report-url` | The URL pointing to the HTML report that has been created by OFT. | diff --git a/.github/actions/run-oft/action.yaml b/.github/actions/run-oft/action.yaml deleted file mode 100644 index fb01aea..0000000 --- a/.github/actions/run-oft/action.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Perform requirements tracing against the uProtocol Specification using OpenFastTrace (https://github.com/itsallcode/openfasttrace) -# Returns the URL of the created HTML report as an output - -name: "Run OpenFastTrace" -description: | - Runs OpenFastTrace with the trace command on files in the local workspace. -inputs: - file-patterns: - description: | - A whitespace separated list of glob patterns which specify the files to include in the OFT trace run. - default: "**/*.*" - required: false -outputs: - oft-exit-code: - description: | - The exit code indicating the outcome of running OpenFastTrace (0: success, 1: failure). - The report is created in any case, as long as OpenFastTrace could be run at all. - value: ${{ steps.run-oft.outputs.oft-exit-code }} - tracing-report-url: - description: "The URL to the OpenFastTrace HTML report" - value: ${{ steps.upload-tracing-report.artifact-url }} - -runs: - using: "composite" - steps: - - shell: bash - run: | - # Prepare Environment - echo "TRACING_REPORT_FILE_NAME=oft-report.html" >> $GITHUB_ENV - - - name: Run OpenFastTrace - id: run-oft - uses: itsallcode/openfasttrace-github-action@v0 - with: - file-patterns: ${{ inputs.file-patterns }} - report-filename: ${{ env.TRACING_REPORT_FILE_NAME }} - report-format: "html" - - - name: Upload tracing report (html) - uses: actions/upload-artifact@v4 - id: upload-tracing-report - if: ${{ steps.run-oft.outputs.oft-exit-code != '' }} - with: - name: tracing-report-html - path: ${{ env.TRACING_REPORT_FILE_NAME }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml deleted file mode 100644 index fac708b..0000000 --- a/.github/workflows/coverage.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Run all test for all features to collect test code coverage information -# Upload coverage info for potential re-use in publication workflow, returns the corresponding download URL as an output on workflow_call -# Can publish coverage info to CodeCov platform, this is controlled by setting CODECOV_TOKEN secret in the github workspace - -name: Test coverage - -on: - workflow_call: - outputs: - test_coverage_url: - description: 'URL of the test coverage artifact' - value: ${{ jobs.coverage.outputs.test_coverage_url }} - workflow_dispatch: - -env: - RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} - RUSTFLAGS: -Dwarnings - CARGO_TERM_COLOR: always - -jobs: - coverage: - name: collect - runs-on: ubuntu-latest - outputs: - test_coverage_url: ${{ steps.test_coverage_html.outputs.artifact-url }} - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - name: Install cargo-tarpaulin - uses: taiki-e/install-action@cargo-tarpaulin - - uses: Swatinem/rust-cache@v2 - - - name: Run tests and report code coverage - run: | - # enable nightly features so that we can also include Doctests - RUSTC_BOOTSTRAP=1 cargo tarpaulin --engine llvm -o xml -o lcov -o html --doc --tests - - - name: Upload coverage report (lcov) - uses: actions/upload-artifact@v4 - id: test_coverage_lcov - with: - name: code-coverage-lcov - path: lcov.info - - name: Upload coverage report (xml) - uses: actions/upload-artifact@v4 - id: test_coverage_xml - with: - name: code-coverage-xml - path: cobertura.xml - - name: Upload coverage report (html) - uses: actions/upload-artifact@v4 - id: test_coverage_html - with: - name: code-coverage-html - path: tarpaulin-report.html - - - name: Upload coverage reports to Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - if: env.CODECOV_TOKEN != '' - uses: codecov/codecov-action@v4.0.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: ${{ vars.GITHUB_REPOSITORY }} - files: lcov.info \ No newline at end of file diff --git a/.github/workflows/license-report.yaml b/.github/workflows/license-report.yaml deleted file mode 100644 index 53fed80..0000000 --- a/.github/workflows/license-report.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Use cargo-about to create a comprehensive report on licenses used by crate and all dependencies -# Upload license report for potential re-use in publication workflow, returns the corresponding download URL as an output on workflow_call -# Note: this feature builds on the license statements as declared by their authors - -name: License report - -on: - workflow_call: - outputs: - license_report_url: - description: "URL of the license report artifact" - value: ${{ jobs.license_check.outputs.license_report_url }} - workflow_dispatch: - -env: - RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} - RUSTFLAGS: -Dwarnings - CARGO_TERM_COLOR: always - -jobs: - license_check: - name: create - runs-on: ubuntu-latest - outputs: - license_report_url: ${{ steps.license_report.outputs.artifact-url }} - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - uses: Swatinem/rust-cache@v2 - - - name: Install cargo-about - run: | - cargo install cargo-about - - name: Create license report - run: | - cargo about generate about.hbs > licenses.html - - uses: actions/upload-artifact@v4 - id: license_report - with: - name: license-report - path: licenses.html \ No newline at end of file diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index c872dab..9ae22b5 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -30,10 +30,10 @@ env: jobs: check-msrv: - uses: ./.github/workflows/verify-msrv.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-msrv.yaml@main check-latest-deps: - uses: ./.github/workflows/verify-latest-deps.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-latest-deps.yaml@main deny: runs-on: ubuntu-latest @@ -47,17 +47,18 @@ jobs: command: check arguments: --all-features + # [impl->req~up-language-ci-test~1] test-all-features: - uses: ./.github/workflows/test-featurematrix.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-test-featurematrix.yaml@main x-build: # The jury is still out on whether this actually adds any value, besides simply being possible... - uses: ./.github/workflows/x-build.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-x-build.yaml@main coverage: - uses: ./.github/workflows/coverage.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-coverage.yaml@main requirements-tracing: - uses: ./.github/workflows/requirements-tracing.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/requirements-tracing.yaml@main with: oft-file-patterns: "${{ vars.UP_SPEC_OPEN_FAST_TRACE_FILE_PATTERNS }} ${{ vars.UP_RUST_OPEN_FAST_TRACE_FILE_PATTERNS }}" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0259012..baca2d6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,19 +29,22 @@ jobs: uses: ./.github/workflows/check.yaml check-msrv: - uses: ./.github/workflows/verify-msrv.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-verify-msrv.yaml@main coverage: - uses: ./.github/workflows/coverage.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-coverage.yaml@main requirements-tracing: - uses: ./.github/workflows/requirements-tracing.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/requirements-tracing.yaml@main with: oft-file-patterns: "${{ vars.UP_SPEC_OPEN_FAST_TRACE_FILE_PATTERNS }} ${{ vars.UP_RUST_OPEN_FAST_TRACE_FILE_PATTERNS }}" licenses: # This works off the license declarations in dependent packages/crates, so if these declarations are wrong, this report will contain erroneous information - uses: ./.github/workflows/license-report.yaml + uses: eclipse-uprotocol/ci-cd/.github/workflows/rust-license-report.yaml@main + with: + templates: "about.hbs" + config: "about.toml" tag_release_artifacts: # This only runs if this workflow is initiated via a tag-push with pattern 'v*' diff --git a/.github/workflows/requirements-tracing.yaml b/.github/workflows/requirements-tracing.yaml deleted file mode 100644 index cbacca4..0000000 --- a/.github/workflows/requirements-tracing.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Performs requirements tracing using OpenFastTrace (https://github.com/itsallcode/openfasttrace) -# Uploads tracing report, returns the corresponding download URL as an output - -name: Requirements tracing - -on: - workflow_call: - inputs: - oft-file-patterns: - description: | - A whitespace separated list of glob patterns which specify the files to include in the OFT trace run. - If not specified, defaults to all files relevant for checking up-rust against the uProtocol Specification. - type: string - outputs: - tracing-report-url: - description: 'URL of the requirements tracing report' - value: ${{ jobs.tracing.outputs.tracing-report-url }} - workflow_dispatch: - inputs: - oft-file-patterns: - description: | - A whitespace separated list of glob patterns which specify the files to include in the OFT trace run. - If not specified, defaults to all files relevant for checking up-rust against the uProtocol Specification. - type: string - -jobs: - tracing: - name: Run OpenFastTrace - runs-on: ubuntu-latest - outputs: - tracing-report-url: ${{ steps.run-oft.outputs.tracing-report-url }} - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - - name: Run OpenFastTrace - id: run-oft - uses: ./.github/actions/run-oft - with: - file-patterns: ${{ inputs.oft-file-patterns }} - - - name: "Determine exit code" - run: | - exit ${{ steps.run-oft.outputs.oft-exit-code }} diff --git a/.github/workflows/test-featurematrix.yaml b/.github/workflows/test-featurematrix.yaml deleted file mode 100644 index 2c0db4b..0000000 --- a/.github/workflows/test-featurematrix.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Test all feature combinations on a range of OS platforms - -name: Matrix-test - -on: - workflow_call: - workflow_dispatch: - -env: - RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} - RUSTFLAGS: -Dwarnings - CARGO_TERM_COLOR: always - -jobs: - # [impl->req~up-language-ci-test~1] - test-all-features: - name: all feature combinations - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - uses: Swatinem/rust-cache@v2 - - name: Install cargo-all-features - run: | - cargo install cargo-all-features - - - name: Show toolchain information - working-directory: ${{ github.workspace }} - run: | - rustup toolchain list - cargo --version - - - name: cargo-check all possible feature combinations - run: | - cargo check-all-features - - name: cargo-test all possible feature combinations - run: | - cargo test-all-features - - - # Alternative to the full feature matrix tested in the step above - somewhat faster... - # multi-os-nextest: - # runs-on: ${{ matrix.os }} - # env: - # NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1 - # strategy: - # matrix: - # os: [ubuntu-latest, windows-latest, macOS-latest] - # feature-flags: ["", "--no-default-features", "--all-features"] - # steps: - # - uses: actions/checkout@v4 - # - uses: dtolnay/rust-toolchain@master - # with: - # toolchain: ${{ env.RUST_TOOLCHAIN }} - # - uses: Swatinem/rust-cache@v2 - # - uses: taiki-e/install-action@nextest - # - name: Run cargo nextest - # run: | - # cargo nextest run --message-format libtest-json-plus ${{ matrix.feature-flags }} diff --git a/.github/workflows/verify-latest-deps.yaml b/.github/workflows/verify-latest-deps.yaml deleted file mode 100644 index 261e5cc..0000000 --- a/.github/workflows/verify-latest-deps.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Checks if the crate can be built using the latest stable toolchain with the latest -# compatible dependencies. -# The job definition has been inspired by the example given in the Rust Cargo book. - -name: Check latest dependencies - -on: - workflow_call: - workflow_dispatch: - -env: - CARGO_TERM_COLOR: always - -jobs: - latest-deps: - name: Latest Dependencies - runs-on: ubuntu-latest - continue-on-error: true - env: - CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: allow - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - run: rustup update stable && rustup default stable - - run: cargo update --verbose - - run: cargo build --verbose --all-features - - run: cargo test --verbose --all-features diff --git a/.github/workflows/verify-msrv.yaml b/.github/workflows/verify-msrv.yaml deleted file mode 100644 index 614b3ed..0000000 --- a/.github/workflows/verify-msrv.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Checks if the MSRV declared in Cargo.toml is correct. - -name: Check MSRV - -on: - workflow_call: - workflow_dispatch: - -env: - RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} - RUSTFLAGS: -Dwarnings - CARGO_TERM_COLOR: always - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - - uses: taiki-e/install-action@cargo-hack - - name: check MSRV - run: | - cargo hack check --rust-version --workspace --all-targets --all-features --ignore-private diff --git a/.github/workflows/x-build.yaml b/.github/workflows/x-build.yaml deleted file mode 100644 index edfeb10..0000000 --- a/.github/workflows/x-build.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# *******************************************************************************/ - -# Run all-feature tests on multiple architecture targets -# Note: tbd whether this adds any actual value... - -name: X-platform - -on: - workflow_call: - workflow_dispatch: - -env: - RUST_TOOLCHAIN: ${{ vars.RUST_TOOLCHAIN || 'stable' }} - RUSTFLAGS: -Dwarnings - CARGO_TERM_COLOR: always - -jobs: - build: - name: build and test - runs-on: ${{ matrix.runner }} - env: - NEXTEST_EXPERIMENTAL_LIBTEST_JSON: 1 - strategy: - matrix: - include: - - name: linux-amd64 - runner: ubuntu-latest - target: x86_64-unknown-linux-gnu - - name: linux-arm64 - runner: ubuntu-latest - target: aarch64-unknown-linux-gnu - - name: win-amd64 - runner: windows-latest - target: x86_64-pc-windows-msvc - - name: macos-amd64 - runner: macos-latest - target: x86_64-apple-darwin - - name: macos-arm64 - runner: macos-latest - target: aarch64-apple-darwin - - steps: - - uses: actions/checkout@v4 - with: - submodules: "recursive" - - - name: Install Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ env.RUST_TOOLCHAIN }} - targets: "${{ matrix.target }}" - - uses: Swatinem/rust-cache@v2 - # Using nextest because it's faster than built-in test - - uses: taiki-e/install-action@nextest - - - name: Run cargo nextest - run: | - cargo nextest run --all-features