Skip to content

Commit

Permalink
Merge pull request #410 from joshuachp/push-moxzwktoxkkq
Browse files Browse the repository at this point in the history
chore(forward): port the release v0.9.3
  • Loading branch information
harlem88 authored Jan 24, 2025
2 parents adfed0d + c369e52 commit d5a0e4b
Show file tree
Hide file tree
Showing 40 changed files with 1,828 additions and 358 deletions.
68 changes: 54 additions & 14 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of Astarte.
#
# Copyright 2022-2024 SECO Mind Srl
# Copyright 2022 - 2025 SECO Mind Srl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,13 +22,16 @@ on:
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
fmt:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: stable / fmt
steps:
- uses: actions/checkout@v4
Expand All @@ -39,14 +42,18 @@ jobs:
- name: Check formatting
run: cargo fmt --check --all
clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: ${{ matrix.toolchain }} / clippy
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -55,40 +62,54 @@ jobs:
- name: Install sccache-cache
uses: mozilla-actions/[email protected]
- name: cargo clippy
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
run: cargo clippy --locked --all-targets --all-features --workspace -- -D warnings
doc:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: nightly / doc
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: Install sccache-cache
uses: mozilla-actions/[email protected]
- name: Install cargo-docs-rs
uses: dtolnay/install@cargo-docs-rs
- run: cargo docs-rs
- run: cargo docs-rs --locked

hack:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: ubuntu / stable / features
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Install sccache-cache
uses: mozilla-actions/[email protected]
- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: cargo hack
run: cargo hack --workspace --feature-powerset check
- name: cargo hack test
# Doesn't test all combination of features, but the space is becoming too large and it takes
# too long
run: cargo hack --each-feature test --locked
minimal-versions:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
name: ubuntu / stable / minimal-versions
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: Install nightly for -Zminimal-versions
Expand All @@ -106,13 +127,17 @@ jobs:
env:
RUSTFLAGS: -D warnings
msrv:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
msrv: [1.78.0]
msrv: [1.78]
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -122,12 +147,12 @@ jobs:
- name: Install cargo hack
uses: taiki-e/install-action@cargo-hack
- name: cargo +${{ matrix.msrv }} check
run: cargo +1.78.0 hack --no-dev-deps check --workspace --exclude astarte-device-sdk-mock --exclude e2e-test
run: cargo +${{ matrix.msrv }} hack --no-dev-deps check --all-features --exclude astarte-device-sdk-mock --exclude e2e-test
# Run semver-check on release branch push or PR
semver:
if: startsWith(github.base_ref, 'release-') || startsWith(github.ref, 'release-')
name: stable / semver
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install sccache-cache
Expand All @@ -136,3 +161,18 @@ jobs:
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
release-type: patch
# Check that the create can be compiled with only the packaged files
for-publish:
name: stable / for-publish
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt update
sudo apt-get -y install libsqlite3-dev libssl-dev
- name: Install sccache-cache
uses: mozilla-actions/[email protected]
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- run: ./scripts/check-for-publish.sh
15 changes: 11 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This file is part of Astarte.
#
# Copyright 2024 SECO Mind Srl
# Copyright 2024 - 2025 SECO Mind Srl
#
# Licensed 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
# 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,
Expand Down Expand Up @@ -43,13 +43,20 @@ jobs:
pr: ${{ github.event.pull_request.number }}
reuse:
uses: ./.github/workflows/reuse-lint.yaml
warmup-caches:
uses: ./.github/workflows/warmup-caches.yaml
needs: [reuse, dco]
check:
uses: ./.github/workflows/check.yaml
needs: [reuse, dco]
needs: [warmup-caches]
test:
uses: ./.github/workflows/test.yaml
secrets: inherit
needs: [reuse, dco]
needs: [warmup-caches]
e2e-test:
uses: ./.github/workflows/e2e-test.yaml
# doesn't need to wait for the cache since creating the astarte cluster takes longer
needs: [reuse, dco]
multi-platform:
uses: ./.github/workflows/multi-platform.yaml
needs: [reuse, dco]
12 changes: 6 additions & 6 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This file is part of Astarte.
#
# Copyright 2024 SECO Mind Srl
# Copyright 2024 - 2025 SECO Mind Srl
#
# Licensed 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
# 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,
Expand All @@ -17,19 +17,19 @@
# SPDX-License-Identifier: Apache-2.0

name: coverage
defaults:
run:
shell: bash
on:
workflow_run:
workflows: ["ci"]
types: [completed]
permissions:
contents: read
actions: read
defaults:
run:
shell: bash
jobs:
upload:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
# Run only if originated from a PR
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
steps:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/dco.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This file is part of Astarte.
#
# Copyright 2024 SECO Mind Srl
# Copyright 2024 - 2025 SECO Mind Srl
#
# Licensed 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
# 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,
Expand All @@ -22,18 +22,22 @@ on:
inputs:
pr:
type: string
description: Number of the PR that triggered the job
workflow_call:
inputs:
pr:
type: string
permissions:
actions: read
pull-requests: read
defaults:
run:
shell: bash
env:
GH_TOKEN: ${{ github.token }}
jobs:
check:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- run: echo 'Checking DCO status for PR \#'${{ inputs.pr }}''
- name: check DCO passed
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#
# This file is part of Astarte.
#
# Copyright 2025 SECO Mind Srl
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#

name: docs

on:
workflow_dispatch:
release:
types:
- published
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: false

jobs:
latest-release:
runs-on: ubuntu-24.04
env:
GH_TOKEN: ${{ github.token }}
CURRENT_RELEASE: ${{ github.event.release.tag_name }}
outputs:
result: ${{ steps.check-release.outputs.RESULT }}
steps:
- name: Check release branch
id: check-release
run: |
latest_release=$(gh release --repo '${{ github.repository }}' list --json='tagName' -q='.[].tagName' | sort --version-sort | tail -n 1)
if [[ "$CURRENT_RELEASE" == "$latest_release" ]]; then
echo "Current branch is the latest release branch"
echo "RESULT=OK" >> "$GITHUB_OUTPUT"
else
echo "Current branch is not the latest release branch"
echo "RESULT=FAILED" >> "$GITHUB_OUTPUT"
fi
push-get-started:
runs-on: ubuntu-24.04
needs: latest-release
if: needs.latest-release.outputs.RESULT == 'OK'
env:
OUR_FILE: 'docs/get-started.md'
THEIR_FILE: './sdk-doc/source/get_started/rust.md'
steps:
# clone the astarte-device-sdk repo
- uses: actions/checkout@v4
# clone the sdk-doc repo
- uses: actions/checkout@v4
with:
repository: astarte-platform/sdk-doc
# this also sets up the ssh key for the git push
ssh-key: ${{ secrets.SDK_DOC_DEPLOY_KEY }}
path: sdk-doc
- name: Compare and copy get started
id: cmp-and-copy-get-started
run: |
# remove hidden portion of documentation
file="$(mktemp)"
./scripts/convert-get-started.sh "$OUR_FILE" > $file
# use diff to print to stderr the changes between the files
status="$(diff "$file" "$THEIR_FILE" 1>&2; echo "$?")"
if [[ $status == '0' ]]; then
echo "Get started are identical, no need for update"
exit 0
elif [[ $status != '1' ]]; then
echo "Troubles"
exit "$status"
fi
echo "Updating get started"
cp -v "$file" "$THEIR_FILE"
cd sdk-doc
git config --local user.email "[email protected]"
git config --local user.name "Astarte Bot"
git add "source/get_started/rust.md"
git commit -m "Update Rust SDK get started"
git push
Loading

0 comments on commit d5a0e4b

Please sign in to comment.