diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7cf2326ee..16dfd0ff3 100644 --- a/.github/workflows/ci.yaml +++ b/.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: @@ -28,12 +32,16 @@ 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: @@ -41,38 +49,27 @@ jobs: 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 }}-${{ matrix.crate }} + + - 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 diff --git a/.github/workflows/mmaps_master.yaml b/.github/workflows/mmaps_master.yaml index 6e757eb8a..584e7a9b4 100644 --- a/.github/workflows/mmaps_master.yaml +++ b/.github/workflows/mmaps_master.yaml @@ -1,5 +1,8 @@ name: build mmaps +env: + SVDTOOLS_VERSION: 0.2.0 + on: push: branches: @@ -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 @@ -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" diff --git a/.github/workflows/mmaps_pr.yaml b/.github/workflows/mmaps_pr.yaml index c20b8d035..516aad848 100644 --- a/.github/workflows/mmaps_pr.yaml +++ b/.github/workflows/mmaps_pr.yaml @@ -1,5 +1,8 @@ name: compare mmaps +env: + SVDTOOLS_VERSION: 0.2.0 + on: pull_request_target: @@ -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 @@ -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: | @@ -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/ diff --git a/.github/workflows/nightlies.yaml b/.github/workflows/nightlies.yaml index 0a7b4ca90..9da070369 100644 --- a/.github/workflows/nightlies.yaml +++ b/.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: @@ -8,17 +14,16 @@ 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: @@ -26,31 +31,23 @@ jobs: 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