Run Robot tests on CI #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: toolbox | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/toolbox.yml' | |
- '**' | |
- '!docs/**' | |
- '!README.md' | |
- '!test/**' | |
pull_request: | |
paths: | |
- '.github/workflows/toolbox.yml' | |
- '**' | |
- '!docs/**' | |
- '!test/**' | |
release: | |
types: [published] | |
jobs: | |
create_archives: | |
if: | | |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }} | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout devtools | |
uses: actions/checkout@v4 | |
- name: Create folders | |
run: | | |
mkdir -p toolbox/cbuild | |
mkdir -p toolbox/packchk | |
mkdir -p toolbox/svdconv | |
mkdir -p toolbox/distribution/bin | |
mkdir -p toolbox/distribution/etc | |
mkdir -p toolbox/distribution/doc | |
- name: Download cbuild release asset | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: "Open-CMSIS-Pack/devtools" | |
version: tags/tools/buildmgr/2.3.0 | |
file: cbuild_install.sh | |
target: toolbox/cbuild/cbuild_install.sh | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download packchk release assets | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: "Open-CMSIS-Pack/devtools" | |
version: tags/tools/packchk/1.4.1 | |
regex: true | |
file: "packchk-.*\\.(zip|tbz2)" | |
target: "toolbox/packchk/" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download svdconv release assets | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: "Open-CMSIS-Pack/devtools" | |
version: tags/tools/svdconv/3.3.46 | |
regex: true | |
file: "svdconv-.*\\.(zip|tbz2)" | |
target: "toolbox/svdconv/" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Unzip and copy files | |
run: | | |
curl https://raw.githubusercontent.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/v1.7.33/schema/PACK.xsd --output distribution/etc/PACK.xsd | |
sudo chmod +x ./cbuild/cbuild_install.sh | |
./cbuild/cbuild_install.sh -x cbuild | |
cp -r cbuild/bin/* distribution/bin | |
cp -r cbuild/etc/* distribution/etc | |
tar -xvf packchk/packchk-*-darwin-amd64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.mac-amd64 | |
tar -xvf packchk/packchk-*-darwin-arm64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.mac-arm64 | |
tar -xvf packchk/packchk-*-linux-amd64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.lin-amd64 | |
tar -xvf packchk/packchk-*-linux-arm64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.lin-arm64 | |
unzip packchk/packchk-\*-windows-amd64.zip -d packchk && mv packchk/packchk.exe distribution/bin/packchk.exe-amd64 | |
unzip packchk/packchk-\*-windows-arm64.zip -d packchk && mv packchk/packchk.exe distribution/bin/packchk.exe-arm64 | |
tar -xvf svdconv/svdconv-*-darwin-amd64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.mac-amd64 | |
tar -xvf svdconv/svdconv-*-darwin-arm64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.mac-arm64 | |
tar -xvf svdconv/svdconv-*-linux-amd64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.lin-amd64 | |
tar -xvf svdconv/svdconv-*-linux-arm64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.lin-arm64 | |
unzip svdconv/svdconv-\*-windows-amd64.zip -d svdconv && mv svdconv/svdconv.exe distribution/bin/svdconv.exe-amd64 | |
unzip svdconv/svdconv-\*-windows-arm64.zip -d svdconv && mv svdconv/svdconv.exe distribution/bin/svdconv.exe-arm64 | |
cp ../docs/LICENSE.txt distribution | |
cp ../docs/index.html distribution/doc | |
working-directory: toolbox | |
- name: Copy files separated by target for archiving | |
run: | | |
mkdir -p zip/cmsis-toolbox-windows-amd64/bin zip/cmsis-toolbox-windows-amd64/etc zip/cmsis-toolbox-windows-amd64/doc | |
mkdir -p zip/cmsis-toolbox-windows-arm64/bin zip/cmsis-toolbox-windows-arm64/etc zip/cmsis-toolbox-windows-arm64/doc | |
mkdir -p zip/cmsis-toolbox-linux-amd64/bin zip/cmsis-toolbox-linux-amd64/etc zip/cmsis-toolbox-linux-amd64/doc | |
mkdir -p zip/cmsis-toolbox-linux-arm64/bin zip/cmsis-toolbox-linux-arm64/etc zip/cmsis-toolbox-linux-arm64/doc | |
mkdir -p zip/cmsis-toolbox-darwin-amd64/bin zip/cmsis-toolbox-darwin-amd64/etc zip/cmsis-toolbox-darwin-amd64/doc | |
mkdir -p zip/cmsis-toolbox-darwin-arm64/bin zip/cmsis-toolbox-darwin-arm64/etc zip/cmsis-toolbox-darwin-arm64/doc | |
cp distribution/bin/cbuild.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbuild.exe | |
cp distribution/bin/cbuild2cmake.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbuild2cmake.exe | |
cp distribution/bin/cbuildgen.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbuildgen.exe | |
cp distribution/bin/cpackget.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cpackget.exe | |
cp distribution/bin/cbridge.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbridge.exe | |
cp distribution/bin/csolution.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/csolution.exe | |
cp distribution/bin/packchk.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/packchk.exe | |
cp distribution/bin/svdconv.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/svdconv.exe | |
cp distribution/bin/cbuild.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbuild.exe | |
cp distribution/bin/cbuild2cmake.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbuild2cmake.exe | |
cp distribution/bin/cbuildgen.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbuildgen.exe | |
cp distribution/bin/cpackget.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cpackget.exe | |
cp distribution/bin/cbridge.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbridge.exe | |
cp distribution/bin/csolution.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/csolution.exe | |
cp distribution/bin/packchk.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/packchk.exe | |
cp distribution/bin/svdconv.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/svdconv.exe | |
cp distribution/bin/cbuild.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbuild | |
cp distribution/bin/cbuild2cmake.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbuild2cmake | |
cp distribution/bin/cbuildgen.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbuildgen | |
cp distribution/bin/cpackget.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cpackget | |
cp distribution/bin/cbridge.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbridge | |
cp distribution/bin/csolution.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/csolution | |
cp distribution/bin/packchk.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/packchk | |
cp distribution/bin/svdconv.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/svdconv | |
cp distribution/bin/cbuild.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbuild | |
cp distribution/bin/cbuild2cmake.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbuild2cmake | |
cp distribution/bin/cbuildgen.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbuildgen | |
cp distribution/bin/cpackget.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cpackget | |
cp distribution/bin/cbridge.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbridge | |
cp distribution/bin/csolution.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/csolution | |
cp distribution/bin/packchk.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/packchk | |
cp distribution/bin/svdconv.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/svdconv | |
cp distribution/bin/cbuild.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbuild | |
cp distribution/bin/cbuild2cmake.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbuild2cmake | |
cp distribution/bin/cbuildgen.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbuildgen | |
cp distribution/bin/cpackget.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cpackget | |
cp distribution/bin/cbridge.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbridge | |
cp distribution/bin/csolution.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/csolution | |
cp distribution/bin/packchk.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/packchk | |
cp distribution/bin/svdconv.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/svdconv | |
cp distribution/bin/cbuild.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbuild | |
cp distribution/bin/cbuild2cmake.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbuild2cmake | |
cp distribution/bin/cbuildgen.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbuildgen | |
cp distribution/bin/cpackget.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cpackget | |
cp distribution/bin/cbridge.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbridge | |
cp distribution/bin/csolution.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/csolution | |
cp distribution/bin/packchk.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/packchk | |
cp distribution/bin/svdconv.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/svdconv | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-windows-amd64/LICENSE.txt | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-windows-arm64/LICENSE.txt | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-linux-amd64/LICENSE.txt | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-linux-arm64/LICENSE.txt | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-darwin-amd64/LICENSE.txt | |
cp distribution/LICENSE.txt zip/cmsis-toolbox-darwin-arm64/LICENSE.txt | |
rm distribution/etc/setup | |
cp -r distribution/etc/* zip/cmsis-toolbox-windows-amd64/etc | |
cp -r distribution/etc/* zip/cmsis-toolbox-windows-arm64/etc | |
cp -r distribution/etc/* zip/cmsis-toolbox-linux-amd64/etc | |
cp -r distribution/etc/* zip/cmsis-toolbox-linux-arm64/etc | |
cp -r distribution/etc/* zip/cmsis-toolbox-darwin-amd64/etc | |
cp -r distribution/etc/* zip/cmsis-toolbox-darwin-arm64/etc | |
cp -r distribution/doc/* zip/cmsis-toolbox-windows-amd64/doc | |
cp -r distribution/doc/* zip/cmsis-toolbox-windows-arm64/doc | |
cp -r distribution/doc/* zip/cmsis-toolbox-linux-amd64/doc | |
cp -r distribution/doc/* zip/cmsis-toolbox-linux-arm64/doc | |
cp -r distribution/doc/* zip/cmsis-toolbox-darwin-amd64/doc | |
cp -r distribution/doc/* zip/cmsis-toolbox-darwin-arm64/doc | |
working-directory: toolbox | |
- name: Set toolchain default paths | |
run: | | |
./scripts/set-default.sh Windows toolbox/zip/cmsis-toolbox-windows-amd64/etc | |
./scripts/set-default.sh Windows toolbox/zip/cmsis-toolbox-windows-arm64/etc | |
./scripts/set-default.sh Linux toolbox/zip/cmsis-toolbox-linux-amd64/etc | |
./scripts/set-default.sh Linux toolbox/zip/cmsis-toolbox-linux-arm64/etc | |
./scripts/set-default.sh Darwin toolbox/zip/cmsis-toolbox-darwin-amd64/etc | |
./scripts/set-default.sh Darwin toolbox/zip/cmsis-toolbox-darwin-arm64/etc | |
- name: Add execution permission to the binaries and set files ownership | |
run: | | |
sudo chmod -R +x */bin/* | |
sudo chown -R root:root * | |
working-directory: toolbox/zip | |
- name: Zip folders | |
run: | | |
zip -r cmsis-toolbox-windows-amd64.zip cmsis-toolbox-windows-amd64 | |
zip -r cmsis-toolbox-windows-arm64.zip cmsis-toolbox-windows-arm64 | |
tar -czvf cmsis-toolbox-linux-amd64.tar.gz cmsis-toolbox-linux-amd64 | |
tar -czvf cmsis-toolbox-linux-arm64.tar.gz cmsis-toolbox-linux-arm64 | |
tar -czvf cmsis-toolbox-darwin-amd64.tar.gz cmsis-toolbox-darwin-amd64 | |
tar -czvf cmsis-toolbox-darwin-arm64.tar.gz cmsis-toolbox-darwin-arm64 | |
working-directory: toolbox/zip | |
- name: Archive windows amd64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-windows-amd64 | |
path: ./toolbox/zip/cmsis-toolbox-windows-amd64.zip | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Archive windows arm64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-windows-arm64 | |
path: ./toolbox/zip/cmsis-toolbox-windows-arm64.zip | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Archive linux amd64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-linux-amd64 | |
path: ./toolbox/zip/cmsis-toolbox-linux-amd64.tar.gz | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Archive linux arm64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-linux-arm64 | |
path: ./toolbox/zip/cmsis-toolbox-linux-arm64.tar.gz | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Archive darwin amd64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-darwin-amd64 | |
path: ./toolbox/zip/cmsis-toolbox-darwin-amd64.tar.gz | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Archive darwin arm64 binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cmsis-toolbox-darwin-arm64 | |
path: ./toolbox/zip/cmsis-toolbox-darwin-arm64.tar.gz | |
retention-days: 1 | |
if-no-files-found: error | |
tests: | |
if: | | |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }} | |
needs: [ create_archives ] | |
timeout-minutes: 15 | |
runs-on: ${{ matrix.config.os }} | |
name: 'Test (${{ matrix.config.target }}, ${{ matrix.config.arch }})' | |
strategy: | |
fail-fast: true | |
matrix: | |
config: | |
- { os: macos-12, target: darwin, arch: amd64 } | |
- { os: macos-12, target: darwin, arch: arm64 } | |
- { os: windows-2019, target: windows, arch: amd64} | |
- { os: windows-2019, target: windows, arch: arm64} | |
- { os: ubuntu-20.04, target: linux, arch: amd64} | |
- { os: ubuntu-20.04, target: linux, arch: arm64} | |
steps: | |
- name: Checkout cmsis-toolbox | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download cmsis toolbox ${{ matrix.config.target }} ${{ matrix.config.arch }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }} | |
path: archive | |
- name: Create directory | |
run: | | |
mkdir -p toolbox | |
- name: unzip cmsis-toolbox windows archive | |
if: ${{ startsWith(matrix.config.os, 'windows') }} | |
run: unzip archive/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }}.zip -d toolbox | |
- name: unzip cmsis-toolbox macos/linux archive | |
if: ${{ startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'ubuntu') }} | |
run: tar -xvf archive/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }}.tar.gz -C toolbox | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
- name: Test with pytest | |
run: | | |
pytest --base-path=toolbox/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }} test/tests.py -rA --junitxml=test-results-${{ matrix.config.target }}-${{ matrix.config.arch }}.xml | |
- name: Archive test report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: toolbox-test-${{ matrix.config.target }}-${{ matrix.config.arch }} | |
path: ./test-results-*.xml | |
retention-days: 1 | |
if-no-files-found: error | |
publish-test-results: | |
if: github.event_name != 'release' | |
name: "Publish Tests Results" | |
needs: [ tests ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: publish test results | |
uses: EnricoMi/publish-unit-test-result-action/composite@v2 | |
with: | |
commit: ${{ github.event.workflow_run.head_sha }} | |
report_individual_runs: true | |
files: "artifacts/**/test-results-*.xml" | |
release: | |
if: ${{ github.event_name == 'release' }} | |
needs: [ tests ] | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Download cmsis toolbox windows amd64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-windows-amd64 | |
path: toolbox/zip | |
- name: Download cmsis toolbox windows arm64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-windows-arm64 | |
path: toolbox/zip | |
- name: Download cmsis toolbox linux amd64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-linux-amd64 | |
path: toolbox/zip | |
- name: Download cmsis toolbox linux arm64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-linux-arm64 | |
path: toolbox/zip | |
- name: Download cmsis toolbox darwin amd64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-darwin-amd64 | |
path: toolbox/zip | |
- name: Download cmsis toolbox darwin arm64 zip | |
uses: actions/download-artifact@v4 | |
with: | |
name: cmsis-toolbox-darwin-arm64 | |
path: toolbox/zip | |
- name: Download test report windows-amd64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-windows-amd64 | |
path: testreports/ | |
- name: Download test report windows-arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-windows-arm64 | |
path: testreports/ | |
- name: Download unit test report linux-amd64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-linux-amd64 | |
path: testreports/ | |
- name: Download unit test report linux-arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-linux-arm64 | |
path: testreports/ | |
- name: Download unit test report darwin-amd64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-darwin-amd64 | |
path: testreports/ | |
- name: Download unit test report darwin-arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: toolbox-test-darwin-arm64 | |
path: testreports/ | |
- name: Zip test reports | |
run: zip -r testreports.zip * | |
working-directory: testreports | |
- name: Attach test report archive to release assets | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: testreports/testreports.zip | |
tag: ${{ github.ref }} | |
overwrite: true | |
asset_name: testreports.zip | |
- name: Calculate checksums | |
run: | | |
sha256sum cmsis-toolbox-windows-amd64.zip --text > cmsis-toolbox-checksums.txt | |
sha256sum cmsis-toolbox-windows-arm64.zip --text >> cmsis-toolbox-checksums.txt | |
sha256sum cmsis-toolbox-linux-amd64.tar.gz --text >> cmsis-toolbox-checksums.txt | |
sha256sum cmsis-toolbox-linux-arm64.tar.gz --text >> cmsis-toolbox-checksums.txt | |
sha256sum cmsis-toolbox-darwin-amd64.tar.gz --text >> cmsis-toolbox-checksums.txt | |
sha256sum cmsis-toolbox-darwin-arm64.tar.gz --text >> cmsis-toolbox-checksums.txt | |
working-directory: toolbox/zip | |
- name: Attach installer to release assets | |
id: release_assets | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: toolbox/zip/cmsis-toolbox-* | |
tag: ${{ github.ref }} | |
overwrite: true | |
file_glob: true |