Skip to content

Rust svdtools for CI #701

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

Merged
merged 1 commit into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions .github/bors.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
required_approvals = 1
block_labels = ["wip"]
delete_merged_branches = true
status = [
"Check (stm32f0)",
"Check (stm32f1)",
"Check (stm32f2)",
"Check (stm32f3)",
"Check (stm32f4)",
"Check (stm32f7)",
"Check (stm32h7)",
"Check (stm32l0)",
"Check (stm32l1)",
"Check (stm32l4)",
"Check (stm32l5)",
"Check (stm32g0)",
"Check (stm32g4)",
"Check (stm32mp1)",
"Check (stm32wl)",
"Check (stm32wb)",
]
status = ["CI"]
58 changes: 35 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
name: CI

env:
SVDTOOLS_VERSION: 0.2.1
SVD2RUST_VERSION: 0.21.0
FORM_VERSION: 0.8.0

on:
push:
branches: [ staging, trying, master ]
pull_request:

jobs:
ci:
name: CI
runs-on: ubuntu-latest
needs: [check]
steps:
- name: Done
run: exit 0

check:
name: Check
runs-on: ubuntu-latest
Expand All @@ -28,51 +41,50 @@ jobs:
- stm32mp1
- stm32wl
- stm32wb

env:
CRATES: ${{ matrix.crate }}
CARGO_INCREMENTAL: 0
SVDTOOLS: svdtools

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt

- name: Install xmllint
run: sudo apt-get install libxml2-utils
- name: Install Python dependencies
run: |
pip3 install --user setuptools wheel
pip3 install --user svdtools
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH
- name: Cache Cargo installed binaries
uses: actions/cache@v1
id: cache-cargo
with:
path: ~/cargo-bin
key: ${{ runner.os }}-svd2rust-0.21.0
- name: Install svd2rust
if: steps.cache-cargo.outputs.cache-hit != 'true'
uses: actions-rs/install@v0.1

- name: Create working crate
run: make crates

- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
crate: svd2rust
version: 0.21.0
- name: Copy svd2rust to cache directory
if: steps.cache-cargo.outputs.cache-hit != 'true'
working-directory: ${{ matrix.crate }}
key: svdtools-${{ env.SVDTOOLS_VERSION }}-svd2rust-${{ env.SVD2RUST_VERSION }}-form-${{ env.FORM_VERSION }}

- name: Install tools
run: |
mkdir ~/cargo-bin
cp ~/.cargo/bin/svd2rust ~/cargo-bin
- name: Put new cargo binary directory into path
run: echo "~/cargo-bin" >> $GITHUB_PATH
cargo install svdtools --version $SVDTOOLS_VERSION --target-dir deps-target
cargo install svd2rust --version $SVD2RUST_VERSION --target-dir deps-target
cargo install form --version $FORM_VERSION --target-dir deps-target

- name: Patch SVDs
run: make -j2 patch

- name: Check SVDs
run: make lint

- name: Build PACs
run: make -j2 svd2rust

- name: Check PACs
run: make -j2 check
26 changes: 21 additions & 5 deletions .github/workflows/mmaps_master.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: build mmaps

env:
SVDTOOLS_VERSION: 0.2.1

on:
push:
branches:
Expand All @@ -9,23 +12,36 @@ jobs:
build:
name: Build mmaps
runs-on: ubuntu-18.04

env:
SVDTOOLS: svdtools

steps:
- name: Checkout stm32-rs
uses: actions/checkout@v2
with:
path: stm32-rs

- name: Checkout mmaps
uses: actions/checkout@v2
with:
repository: stm32-rs/stm32-rs-mmaps
ssh-key: ${{ secrets.MMAPS_KEY }}
path: stm32-rs-mmaps
- name: Install Python dependencies

- name: Add fictive crate
run: |
pip3 install --user setuptools wheel
pip3 install --user svdtools
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH
cargo init

- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
key: svdtools-${{ env.SVDTOOLS_VERSION }}

- name: Install svdtools
run: |
cargo install svdtools --version $SVDTOOLS_VERSION

- name: Build and publish
run: |
cd stm32-rs
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/mmaps_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: compare mmaps

env:
SVDTOOLS_VERSION: 0.2.1

on:
pull_request_target:

Expand All @@ -8,28 +11,42 @@ jobs:
name: Compare mmaps
runs-on: ubuntu-18.04
continue-on-error: true

env:
SVDTOOLS: svdtools

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
path: master

- name: Checkout pull request
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.number }}/head
path: pr

- name: Checkout mmaps
uses: actions/checkout@v2
with:
repository: stm32-rs/stm32-rs-mmaps
ssh-key: ${{ secrets.MMAPS_KEY }}
path: mmaps
- name: Install Python dependencies

- name: Add fictive crate
run: |
pip3 install --user setuptools wheel
pip3 install --user svdtools
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH
cargo init

- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
key: svdtools-${{ env.SVDTOOLS_VERSION }}

- name: Install svdtools
run: |
cargo install svdtools --version $SVDTOOLS_VERSION

- name: Build and publish
run: |
# Grab commit ID from checked out PR
Expand Down
54 changes: 25 additions & 29 deletions .github/workflows/nightlies.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
name: build nightlies

env:
SVDTOOLS_VERSION: 0.2.1
SVD2RUST_VERSION: 0.21.0
FORM_VERSION: 0.8.0

on:
push:
branches:
Expand All @@ -8,49 +14,39 @@ jobs:
build:
name: Build
runs-on: ubuntu-18.04

env:
SVDTOOLS: svdtools

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
path: stm32-rs
- name: Install Python dependencies
run: |
pip3 install --user setuptools wheel
pip3 install --user svdtools
- name: Put pip binary directory into path
run: echo "~/.local/bin" >> $GITHUB_PATH

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
- name: Cache Cargo installed binaries
uses: actions/cache@v1
id: cache-cargo
with:
path: ~/cargo-bin
key: ${{ runner.os }}-cargo-binaries-0.18.0
- name: Install svd2rust
if: steps.cache-cargo.outputs.cache-hit != 'true'
uses: actions-rs/cargo@v1
with:
command: install
args: svd2rust --version 0.21.0
- name: Install form
if: steps.cache-cargo.outputs.cache-hit != 'true'
uses: actions-rs/cargo@v1

- name: Add fictive crate
run: |
cargo init

- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
command: install
args: form --version 0.7.0
- name: Copy svd2rust and form to cache directory
if: steps.cache-cargo.outputs.cache-hit != 'true'
key: svdtools-${{ env.SVDTOOLS_VERSION }}-svd2tust-${{ env.SVD2RUST_VERSION }}-form-${{ env.FORM_VERSION }}

- name: Install dependencies
run: |
mkdir ~/cargo-bin
cp ~/.cargo/bin/{svd2rust,form} ~/cargo-bin
- name: Put cargo binary directory into path
run: echo "~/cargo-bin" >> $GITHUB_PATH
cargo install svdtools --version $SVDTOOLS_VERSION --target-dir deps-target
cargo install svd2rust --version $SVD2RUST_VERSION --target-dir deps-target
cargo install form --version $FORM_VERSION --target-dir deps-target

- name: Deploy SSH key
run: |
mkdir ~/.ssh
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

* Replace python svd tools with rust alternatives
* Updated to svd2rust 0.21
* `SVDTOOLS` env value for specifying patching tool

Expand Down