rtic/.github/workflows/build.yml
bors[bot] ad1833ce91
Merge #678 #679
678: Bump actions/cache from 2 to 3 r=AfoHT a=dependabot[bot]

Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/actions/cache/releases">actions/cache's releases</a>.</em></p>
<blockquote>
<h2>v3.0.0</h2>
<ul>
<li>
<p>This change adds a minimum runner version(node12 -&gt; node16), which can break users using an out-of-date/fork of the runner. This would be most commonly affecting users on GHES 3.3 or before, as those runners do not support node16 actions and they can use actions from github.com via <a href="https://docs.github.com/en/enterprise-server@3.0/admin/github-actions/managing-access-to-actions-from-githubcom/enabling-automatic-access-to-githubcom-actions-using-github-connect">github connect</a> or manually copying the repo to their GHES instance.</p>
</li>
<li>
<p>Few dependencies and cache action usage examples have also been updated.</p>
</li>
</ul>
<h2>v2.1.7</h2>
<p>Support 10GB cache upload using the latest version <code>1.0.8</code> of <a href="https://www.npmjs.com/package/`@actions/cache"><code>@actions/cache</code>` </a></p>
<h2>v2.1.6</h2>
<ul>
<li>Catch unhandled &quot;bad file descriptor&quot; errors that sometimes occurs when the cache server returns non-successful response (<a href="https://github-redirect.dependabot.com/actions/cache/pull/596">actions/cache#596</a>)</li>
</ul>
<h2>v2.1.5</h2>
<ul>
<li>Fix permissions error seen when extracting caches with GNU tar that were previously created using BSD tar (<a href="https://github-redirect.dependabot.com/actions/cache/issues/527">actions/cache#527</a>)</li>
</ul>
<h2>v2.1.4</h2>
<ul>
<li>Make caching more verbose <a href="https://github-redirect.dependabot.com/actions/toolkit/pull/650">#650</a></li>
<li>Use GNU tar on macOS if available <a href="https://github-redirect.dependabot.com/actions/toolkit/pull/701">#701</a></li>
</ul>
<h2>v2.1.3</h2>
<ul>
<li>Upgrades <code>`@actions/core</code>` to v1.2.6 for <a href="https://github.com/advisories/GHSA-mfwh-5m23-j46w">CVE-2020-15228</a>. This action was not using the affected methods.</li>
<li>Fix error handling in <code>uploadChunk</code> where 400-level errors were not being detected and handled correctly</li>
</ul>
<h2>v2.1.2</h2>
<ul>
<li>Adds input to limit the chunk upload size, useful for self-hosted runners with slower upload speeds</li>
<li>No-op when executing on GHES</li>
</ul>
<h2>v2.1.1</h2>
<ul>
<li>Update <code>`@actions/cache</code>` package to <code>v1.0.2</code> which allows cache action to use posix format when taring files.</li>
</ul>
<h2>v2.1.0</h2>
<ul>
<li>Replaces the <code>http-client</code> with the Azure Storage SDK for NodeJS when downloading cache content from Azure.  This should help improve download performance and reliability as the SDK downloads files in 4 MB chunks, which can be parallelized and retried independently</li>
<li>Display download progress and speed</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/actions/cache/blob/main/RELEASES.md">actions/cache's changelog</a>.</em></p>
<blockquote>
<h1>Releases</h1>
<h3>3.0.0</h3>
<ul>
<li>Updated minimum runner version support from node 12 -&gt; node 16</li>
</ul>
<h3>3.0.1</h3>
<ul>
<li>Added support for caching from GHES 3.5.</li>
<li>Fixed download issue for files &gt; 2GB during restore.</li>
</ul>
<h3>3.0.2</h3>
<ul>
<li>Added support for dynamic cache size cap on GHES.</li>
</ul>
<h3>3.0.3</h3>
<ul>
<li>Fixed avoiding empty cache save when no files are available for caching. (<a href="https://github-redirect.dependabot.com/actions/cache/issues/624">issue</a>)</li>
</ul>
<h3>3.0.4</h3>
<ul>
<li>Fixed tar creation error while trying to create tar with path as <code>~/</code> home folder on <code>ubuntu-latest</code>. (<a href="https://github-redirect.dependabot.com/actions/cache/issues/689">issue</a>)</li>
</ul>
<h3>3.0.5</h3>
<ul>
<li>Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. (<a href="https://github-redirect.dependabot.com/actions/cache/pull/834">PR</a>)</li>
</ul>
<h3>3.0.6</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/actions/cache/issues/809">#809</a> - zstd -d: no such file or directory error</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/actions/cache/issues/833">#833</a> - cache doesn't work with github workspace directory</li>
</ul>
<h3>3.0.7</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/actions/cache/issues/810">#810</a> - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.</li>
</ul>
<h3>3.0.8</h3>
<ul>
<li>Fix zstd not working for windows on gnu tar in issues <a href="https://github-redirect.dependabot.com/actions/cache/issues/888">#888</a> and <a href="https://github-redirect.dependabot.com/actions/cache/issues/891">#891</a>.</li>
<li>Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable <code>SEGMENT_DOWNLOAD_TIMEOUT_MINS</code>. Default is 60 minutes.</li>
</ul>
<h3>3.0.9</h3>
<ul>
<li>Enhanced the warning message for cache unavailablity in case of GHES.</li>
</ul>
<h3>3.0.10</h3>
<ul>
<li>Fix a bug with sorting inputs.</li>
<li>Update definition for restore-keys in README.md</li>
</ul>
<h3>3.0.11</h3>
<ul>
<li>Update toolkit version to 3.0.5 to include <code>`@actions/core@^1.10.0</code></li>`
<li>Update <code>`@actions/cache</code>` to use updated <code>saveState</code> and <code>setOutput</code> functions from <code>`@actions/core@^1.10.0</code></li>`
</ul>
<h3>3.1.0-beta.1</h3>
<ul>
<li>Update <code>`@actions/cache</code>` on windows to use gnu tar and zstd by default and fallback to bsdtar and zstd if gnu tar is not available. (<a href="https://github-redirect.dependabot.com/actions/cache/issues/984">issue</a>)</li>
</ul>
<h3>3.1.0-beta.2</h3>
<ul>
<li>Added support for fallback to gzip to restore old caches on windows.</li>
</ul>
<h3>3.1.0-beta.3</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="4723a57e26"><code>4723a57</code></a> Revert compression changes related to windows but keep version logging (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1049">#1049</a>)</li>
<li><a href="d1507cccba"><code>d1507cc</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/actions/cache/issues/1042">#1042</a> from me-and/correct-readme-re-windows</li>
<li><a href="3337563725"><code>3337563</code></a> Merge branch 'main' into correct-readme-re-windows</li>
<li><a href="60c7666709"><code>60c7666</code></a> save/README.md: Fix typo in example (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1040">#1040</a>)</li>
<li><a href="b053f2b699"><code>b053f2b</code></a> Fix formatting error in restore/README.md (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1044">#1044</a>)</li>
<li><a href="501277cfd7"><code>501277c</code></a> README.md: remove outdated Windows cache tip link</li>
<li><a href="c1a5de879e"><code>c1a5de8</code></a> Upgrade codeql to v2 (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1023">#1023</a>)</li>
<li><a href="9b0be58822"><code>9b0be58</code></a> Release compression related changes for windows (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1039">#1039</a>)</li>
<li><a href="c17f4bf466"><code>c17f4bf</code></a> GA for granular cache (<a href="https://github-redirect.dependabot.com/actions/cache/issues/1035">#1035</a>)</li>
<li><a href="ac25611cae"><code>ac25611</code></a> docs: fix an invalid link in workarounds.md (<a href="https://github-redirect.dependabot.com/actions/cache/issues/929">#929</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/actions/cache/compare/v2...v3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/cache&package-manager=github_actions&previous-version=2&new-version=3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

679: Update panic-semihosting requirement from 0.5.2 to 0.6.0 r=AfoHT a=dependabot[bot]

Updates the requirements on [panic-semihosting](https://github.com/rust-embedded/cortex-m) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rust-embedded/cortex-m/blob/master/CHANGELOG.md">panic-semihosting's changelog</a>.</em></p>
<blockquote>
<h2>[v0.6.0] - 2019-03-12</h2>
<h3>Fixed</h3>
<ul>
<li>Fix numerous registers which were incorrectly included for thumbv6</li>
<li><code>SHCRS</code> renamed to <code>SHCSR</code> in <code>SCB</code></li>
</ul>
<h3>Added</h3>
<ul>
<li>
<p>Support for ARMv8-M (<code>thumbv8.base</code> and <code>thumbv8.main</code>)</p>
</li>
<li>
<p><code>SCB</code> gained methods to set and clear <code>SLEEPONEXIT</code> bit</p>
</li>
<li>
<p><code>NVIC</code> gained <code>STIR</code> register and methods to request an interrupt</p>
</li>
<li>
<p><code>DCB</code> gained methods to check if debugger is attached</p>
</li>
</ul>
<h2>[v0.5.8] - 2018-10-27</h2>
<h3>Added</h3>
<ul>
<li>
<p><code>SCB</code> gained methods to set, clear and check the pending state of the PendSV
exception.</p>
</li>
<li>
<p><code>SCB</code> gained methods to set, clear and check the pending state of the SysTick
exception.</p>
</li>
<li>
<p><code>SCB</code> gained methods to set and get the priority of system handlers like
SVCall and SysTick.</p>
</li>
<li>
<p><code>NVIC</code> gained <em>static</em> methods, <code>pend</code> and <code>unpend</code>, to set and clear the
pending state of interrupts.</p>
</li>
</ul>
<h3>Changed</h3>
<ul>
<li>The <code>NVIC.{clear,set}_pending</code> methods have been deprecated in favor of
<code>NVIC::{unpend,pend}</code>.</li>
</ul>
<h2>[v0.5.7] - 2018-09-06</h2>
<h3>Added</h3>
<ul>
<li><code>DCB::enable_trace()</code> and <code>DCB::disable_trace()</code></li>
</ul>
<h3>Changed</h3>
<ul>
<li><code>iprintln!</code> no longer depends on <code>iprint!</code>. <code>cortex_m::iprintln!</code> will work
even if <code>cortex_m::iprint</code> has not been imported.</li>
</ul>
<h2>[v0.5.6] - 2018-08-27</h2>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c61e3af53a"><code>c61e3af</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/135">#135</a></li>
<li><a href="3e580d9d92"><code>3e580d9</code></a> v0.6.0</li>
<li><a href="563c27a152"><code>563c27a</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/106">#106</a></li>
<li><a href="3b574e88fb"><code>3b574e8</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/127">#127</a></li>
<li><a href="771fc84d6e"><code>771fc84</code></a> Fix STIR register test, remove armv6m-related offsets in NVIC</li>
<li><a href="ac5f677f57"><code>ac5f677</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/97">#97</a></li>
<li><a href="04ee333b63"><code>04ee333</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/126">#126</a></li>
<li><a href="2ff4735cda"><code>2ff4735</code></a> Update is_debugger_attached so as not to clear S_RESET_ST and S_RETIRE_ST</li>
<li><a href="2a15caa848"><code>2a15caa</code></a> Fix rebase syntax error; disable STIR test on armv6m</li>
<li><a href="595fbd7346"><code>595fbd7</code></a> Expand is_debugger_attached note</li>
<li>Additional commits viewable in <a href="https://github.com/rust-embedded/cortex-m/compare/v0.5.2...v0.6.0">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 21:48:33 +00:00

519 lines
15 KiB
YAML

name: Build
on:
pull_request:
push:
branches:
- master
- staging
- trying
- bors/staging
- bors/trying
env:
CARGO_TERM_COLOR: always
jobs:
# Run cargo fmt --check, includes macros/
style:
name: style
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: cargo fmt --check
run: cargo fmt --all -- --check
# Compilation check
check:
name: check
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
- x86_64-unknown-linux-gnu
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target (${{ matrix.target }})
run: rustup target add ${{ matrix.target }}
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: cargo check
run: cargo check --target=${{ matrix.target }}
# Clippy
clippy:
name: Cargo clippy
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: Add Rust component clippy
run: rustup component add clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: cargo clippy
run: cargo clippy
# Verify all examples, checks
checkexamples:
name: checkexamples
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
- thumbv8m.base-none-eabi
- thumbv8m.main-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target (${{ matrix.target }})
run: rustup target add ${{ matrix.target }}
- name: Add Rust component llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Check the examples
run: cargo check --examples --target=${{ matrix.target }}
# Verify the example output with run-pass tests
testexamples:
name: testexamples
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target (${{ matrix.target }})
run: rustup target add ${{ matrix.target }}
- name: Add Rust component llvm-tools-preview
run: rustup component add llvm-tools-preview
# Use precompiled binutils
- name: cargo install cargo-binutils
run: cargo install cargo-binutils
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Install QEMU
run: |
sudo apt update
sudo apt install -y qemu-system-arm
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: Run-pass tests
run: cargo xtask --target ${{ matrix.target }}
# Check the correctness of macros/ crate
checkmacros:
name: checkmacros
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
toolchain:
- stable
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ matrix.toolchain }}
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
- name: Configure Rust target (${{ matrix.target }})
run: rustup target add ${{ matrix.target }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: cargo check
run: cargo check --manifest-path macros/Cargo.toml --target=${{ matrix.target }}
# Run the macros test-suite
testmacros:
name: testmacros
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: cargo check
run: cargo test --manifest-path macros/Cargo.toml
# Run test suite
tests:
name: tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: Run cargo test
run: cargo test --test tests
# Build documentation, check links
docs:
name: docs
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache pip installed linkchecker
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: pip install git+https://github.com/linkchecker/linkchecker.git
- name: Remove cargo-config
run: rm -f .cargo/config
- name: Fail on warnings
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
- name: Build docs
run: cargo doc
- name: Check links
run: |
td=$(mktemp -d)
cp -r target/doc $td/api
linkchecker $td/api/rtic/
linkchecker $td/api/cortex_m_rtic_macros/
# Build the books
mdbook:
name: mdbook
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: pip install git+https://github.com/linkchecker/linkchecker.git
- name: mdBook Action
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- name: Build book in English
shell: 'script --return --quiet --command "bash {0}"'
run: cd book/en && if mdbook build |& tee /dev/tty | grep "\[ERROR\]"; then exit 1; else exit 0; fi
- name: Build book in Russian
shell: 'script --return --quiet --command "bash {0}"'
run: cd book/ru && if mdbook build |& tee /dev/tty | grep "\[ERROR\]"; then echo "Russian book needs updating!"; else exit 0; fi
- name: Check links
run: |
td=$(mktemp -d)
mkdir $td/book
cp -r book/en/book $td/book/en
cp -r book/ru/book $td/book/ru
cp LICENSE-* $td/book/en
cp LICENSE-* $td/book/ru
linkchecker $td/book/en/
linkchecker $td/book/ru/
# Update stable branch
#
# This needs to run before book is built
mergetostablebranch:
name: If CI passes, merge master branch into release/vX
runs-on: ubuntu-22.04
needs:
- style
- check
- clippy
- checkexamples
- testexamples
- checkmacros
- testmacros
- tests
- docs
- mdbook
# Only run this when pushing to master branch
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Get crate version and print output branch release/vX
id: crateversionbranch
# Parse metadata for version number, extract the Semver Major
run: |
VERSION=$(cargo metadata --format-version 1 --no-deps --offline | jq -r '.packages[] | select(.name =="cortex-m-rtic") | .version')
VERSIONMAJOR=${VERSION%.*.*}
echo "branch=release/v$VERSIONMAJOR" >> $GITHUB_ENV
echo "versionmajor=$VERSIONMAJOR" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_ENV
- uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ github.token }}
source_ref: 'master'
target_branch: ${{ env.branch }}
commit_message_template: '[Bors] Merged {source_ref} into target {target_branch}'
# Only runs when pushing to master branch
# Bors run CI against staging branch,
# if that succeeds Borst tries against master branch
# If all tests pass, then deploy stage is run
deploy:
name: deploy
runs-on: ubuntu-22.04
needs:
mergetostablebranch
# Only run this when pushing to master branch
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: mdBook Action
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- name: Get crate version
id: crateversion
# Parse metadata for version number, extract the Semver Major
run: |
VERSION=$(cargo metadata --format-version 1 --no-deps --offline | jq -r '.packages[] | select(.name =="cortex-m-rtic") | .version')
VERSIONMAJOR=${VERSION%.*.*}
echo "branch=release/v$VERSIONMAJOR" >> $GITHUB_ENV
echo "versionmajor=$VERSIONMAJOR" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_ENV
- name: Remove cargo-config
run: rm -f .cargo/config
- name: Build docs
run: cargo doc
- name: Build books
shell: 'script --return --quiet --command "bash {0}"'
run: |
langs=( en ru )
devver=( dev )
# The latest stable must be the first element in the array
vers=( "1" "0.5" "0.4" )
# All releases start with "v"
# followed by MAJOR.MINOR.PATCH, see semver.org
# Store first in array as stable
stable=${vers}
crateversion={{ env.versionmajor }}
echo "Latest stable version: $stable"
echo "Current crate version: $crateversion"
# Create directories
td=$(mktemp -d)
mkdir -p $td/$devver/book/
cp -r target/doc $td/$devver/api
# Redirect rtic.rs/meeting/index.html to hackmd
mkdir $td/meeting
sed "s|URL|https://hackmd.io/c_mFUZL-Q2C6614MlrrxOg|g" redirect.html > $td/meeting/index.html
sed -i "s|Page Redirection|RTIC Meeting|" $td/meeting/index.html
sed -i "s|If you|Redirecting to RTIC HackMD. If you|" $td/meeting/index.html
# Redirect the main site to the stable release
sed "s|URL|$stable|g" redirect.html > $td/index.html
# Create the redirects for dev-version
# If the current stable and the version being built differ,
# then there is a dev-version and the links should point to it.
if [[ "$stable" != "$crateversion" ]];
then
sed 's|URL|rtic/index.html|g' redirect.html > $td/$devver/api/index.html
sed 's|URL|book/en|g' redirect.html > $td/$devver/index.html
else
# If the current stable and the "dev" version in master branch
# share the same major version, redirect dev/ to stable book
sed 's|URL|rtic.rs/$stable/api/rtic|g' redirect.html > $td/$devver/api/index.html
sed 's|URL|rtic.rs/$stable|g' redirect.html > $td/$devver/index.html
fi
# Build books
for lang in ${langs[@]}; do
( cd book/$lang &&
if mdbook build |& tee /dev/tty | grep "\[ERROR\]"; then exit 1; else exit 0; fi
)
cp -r book/$lang/book $td/$devver/book/$lang
cp LICENSE-* $td/$devver/book/$lang/
done
# Build older versions, including stable
root=$(pwd)
for ver in ${vers[@]}; do
prefix=${ver}
mkdir -p $td/$prefix/book
src=$(mktemp -d)
curl -L https://github.com/rtic-rs/cortex-m-rtic/archive/release/v${ver}.tar.gz | tar xz --strip-components 1 -C $src
pushd $src
rm -f .cargo/config
cargo doc || cargo doc --features timer-queue
cp -r target/doc $td/$prefix/api
sed 's|URL|rtic/index.html|g' $root/redirect.html > $td/$prefix/api/index.html
for lang in ${langs[@]}; do
( cd book/$lang &&
if mdbook build |& tee /dev/tty | grep "\[ERROR\]"; then exit 1; else exit 0; fi
)
cp -r book/$lang/book $td/$prefix/book/$lang
cp LICENSE-* $td/$prefix/book/$lang/
done
sed 's|URL|book/en|g' $root/redirect.html > $td/$prefix/index.html
popd
rm -rf $src
done
# Copy the stable book to the stable alias
cp -r $td/$stable $td/stable
# Forward CNAME file
cp CNAME $td/
mv $td/ bookstodeploy
- name: Deploy to GH-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./bookstodeploy
force_orphan: true
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
#
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
ci-success:
name: ci
if: github.event_name == 'push' && success()
needs:
- style
- check
- clippy
- checkexamples
- testexamples
- checkmacros
- testmacros
- tests
- docs
- mdbook
runs-on: ubuntu-22.04
steps:
- name: Mark the job as a success
run: exit 0