Skip to content

Commit

Permalink
use Rust svdtools + cache
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Feb 11, 2022
1 parent 5c221ac commit b76af2f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 61 deletions.
53 changes: 25 additions & 28 deletions .github/workflows/ci.yaml
@@ -1,8 +1,12 @@
name: CI

env:
SVDTOOLS_VERSION: 0.2.0
SVD2RUST_VERSION: 0.21.0

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

jobs:
Expand All @@ -28,51 +32,44 @@ 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 }}-svd2tust-${{ env.SVD2RUST_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
rm -rf 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
17 changes: 15 additions & 2 deletions .github/workflows/mmaps_master.yaml
@@ -1,5 +1,8 @@
name: build mmaps

env:
SVDTOOLS_VERSION: 0.2.0

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

env:
SVDTOOLS: svdtools

steps:
- name: Checkout stm32-rs
uses: actions/checkout@v2
Expand All @@ -22,18 +29,24 @@ jobs:
ssh-key: ${{ secrets.MMAPS_KEY }}
path: stm32-rs-mmaps

- name: Add fictive crate
run: |
cargo init
- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
key: svdtools-${{ env.SVDTOOLS_VERSION }}

- name: Install svdtools
run: |
cargo install svdtools --version 0.2.0
cargo install svdtools --version $SVDTOOLS_VERSION
- name: Build and publish
run: |
cd stm32-rs
COMMIT=$(git rev-parse HEAD)
SVDTOOLS=svdtools make -j2 mmaps
make -j2 mmaps
mv mmaps/* ../stm32-rs-mmaps/
cd ../stm32-rs-mmaps
git config user.name "stm32-rs builder"
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/mmaps_pr.yaml
@@ -1,5 +1,8 @@
name: compare mmaps

env:
SVDTOOLS_VERSION: 0.2.0

on:
pull_request_target:

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

env:
SVDTOOLS: svdtools

steps:
- name: Checkout master
uses: actions/checkout@v2
Expand All @@ -27,12 +34,18 @@ jobs:
ssh-key: ${{ secrets.MMAPS_KEY }}
path: mmaps

- name: Add fictive crate
run: |
cargo init
- name: Cache dependencies
uses: Swatinem/rust-cache@v1
with:
key: svdtools-${{ env.SVDTOOLS_VERSION }}

- name: Install svdtools
run: |
cargo install svdtools --version 0.2.0
cargo install svdtools --version $SVDTOOLS_VERSION
- name: Build and publish
run: |
Expand All @@ -46,7 +59,7 @@ jobs:
cd ../master
rm -rf devices peripherals
mv ../pr/devices ../pr/peripherals .
SVDTOOLS=svdtools make -j2 mmaps
make -j2 mmaps
# Use the new mmaps to make a commit in the mmaps repo
mv mmaps/* ../mmaps/
Expand Down
55 changes: 26 additions & 29 deletions .github/workflows/nightlies.yaml
@@ -1,4 +1,10 @@
name: build nightlies

env:
SVDTOOLS_VERSION: 0.2.0
SVD2RUST_VERSION: 0.21.0
FORM_VERSION: 0.8.0

on:
push:
branches:
Expand All @@ -8,49 +14,40 @@ 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 }}

- 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
rm -rf deps-target
- name: Deploy SSH key
run: |
mkdir ~/.ssh
Expand Down

0 comments on commit b76af2f

Please sign in to comment.