-
Notifications
You must be signed in to change notification settings - Fork 0
Initialize dmuart repository template based on dmgpio and dmclk #3
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
Changes from all commits
21a5abb
b9dcebf
735d9db
f946c3e
599c2ea
9b366ca
1dbb9d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop, 'feature/**', 'copilot/**' ] | ||
|
|
||
| jobs: | ||
| discover-cpu-families: | ||
| name: Discover CPU Families | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| cpu_families: ${{ steps.list-families.outputs.cpu_families }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: List available CPU families | ||
| id: list-families | ||
| run: | | ||
| # Find all CPU families by looking for directories containing port.c | ||
| CPU_FAMILIES=$(find src/port -mindepth 2 -maxdepth 2 -name "port.c" -type f -printf '%h\n' | \ | ||
| xargs -n1 basename | \ | ||
| sort | \ | ||
| jq -R -s -c 'split("\n") | map(select(length > 0))') | ||
|
|
||
| echo "Found CPU families: $CPU_FAMILIES" | ||
| echo "cpu_families=$CPU_FAMILIES" >> $GITHUB_OUTPUT | ||
|
|
||
| build-dmuart: | ||
| name: Build dmuart for ${{ matrix.cpu_family }} | ||
| needs: discover-cpu-families | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| matrix: | ||
| cpu_family: ${{ fromJson(needs.discover-cpu-families.outputs.cpu_families) }} | ||
|
|
||
| container: | ||
| image: chocotechnologies/dmod:1.0.4 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build dmuart for ${{ matrix.cpu_family }} | ||
| run: | | ||
| set -e | ||
| CPU_FAMILY="${{ matrix.cpu_family }}" | ||
| mkdir -p build_$CPU_FAMILY | ||
| cd build_$CPU_FAMILY | ||
|
|
||
| cmake .. -DDMUART_MCU_SERIES="${CPU_FAMILY}" | ||
| cmake --build . | ||
|
|
||
| echo "Build completed for CPU family: ${CPU_FAMILY}" | ||
| ls -lh dmf/ | ||
|
|
||
| - name: Verify dmuart_port module files | ||
| run: | | ||
| CPU_FAMILY="${{ matrix.cpu_family }}" | ||
| echo "Checking for dmuart_port module files for ${CPU_FAMILY}..." | ||
| ls -lh build_$CPU_FAMILY/dmf/ | ||
| test -f build_$CPU_FAMILY/dmf/dmuart_port.dmf | ||
| test -f build_$CPU_FAMILY/dmf/dmuart_port_version.txt | ||
| echo "Module files present for ${CPU_FAMILY}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,252 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| discover-cpu-families: | ||
| name: Discover CPU Families | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| cpu_families: ${{ steps.list-families.outputs.cpu_families }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: List available CPU families | ||
| id: list-families | ||
| run: | | ||
| # Find all CPU families by looking for directories containing port.c | ||
| CPU_FAMILIES=$(find src/port -mindepth 2 -maxdepth 2 -name "port.c" -type f -printf '%h\n' | \ | ||
| xargs -n1 basename | \ | ||
| sort | \ | ||
| jq -R -s -c 'split("\n") | map(select(length > 0))') | ||
|
|
||
| echo "Found CPU families: $CPU_FAMILIES" | ||
| echo "cpu_families=$CPU_FAMILIES" >> $GITHUB_OUTPUT | ||
|
|
||
| build-dmuart: | ||
| name: Build dmuart_port for ${{ matrix.cpu_family }} | ||
| needs: discover-cpu-families | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| strategy: | ||
| matrix: | ||
| cpu_family: ${{ fromJson(needs.discover-cpu-families.outputs.cpu_families) }} | ||
|
|
||
| container: | ||
| image: chocotechnologies/dmod:1.0.4 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Extract version from tag | ||
| id: get_version | ||
| run: | | ||
| # Extract version from tag (e.g., v1.2 -> 1.2) | ||
| VERSION="${{ github.event.release.tag_name }}" | ||
| VERSION="${VERSION#v}" # Remove 'v' prefix if present | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Extracted version: $VERSION" | ||
|
|
||
| - name: Build dmuart for ${{ matrix.cpu_family }} | ||
| run: | | ||
| set -e | ||
| CPU_FAMILY="${{ matrix.cpu_family }}" | ||
| BUILD_NAME="port-${CPU_FAMILY}" | ||
| echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV | ||
| echo "ARTIFACT_NAME=release-$BUILD_NAME" >> $GITHUB_ENV | ||
| mkdir -p build_$BUILD_NAME | ||
| cd build_$BUILD_NAME | ||
|
|
||
| cmake .. \ | ||
| -DDMOD_MODULE_VERSION="${{ steps.get_version.outputs.version }}" \ | ||
| -DDMUART_MCU_SERIES="${CPU_FAMILY}" | ||
|
|
||
| cmake --build . | ||
|
|
||
| echo "Build completed for CPU family: ${CPU_FAMILY}" | ||
| ls -la dmf/ || echo "No dmf directory" | ||
| ls -la dmfc/ || echo "No dmfc directory" | ||
|
|
||
| - name: Add release notes and create release archives | ||
| run: | | ||
| set -e | ||
| BUILD_DIR="build_$BUILD_NAME" | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| CPU="${{ matrix.cpu_family }}" | ||
|
|
||
| # Add release notes to dmuart package and create release archive | ||
| echo "${{ github.event.release.body }}" > "$BUILD_DIR/packages/dmuart/RELEASE_NOTES.txt" | ||
| cd "$BUILD_DIR/packages/dmuart" | ||
| zip -r "${OLDPWD}/dmuart-${TAG}-${CPU}.zip" . | ||
| cd - | ||
|
|
||
| # Add release notes to dmuart_port package and create release archive | ||
| echo "${{ github.event.release.body }}" > "$BUILD_DIR/packages/dmuart_port/RELEASE_NOTES.txt" | ||
| cd "$BUILD_DIR/packages/dmuart_port" | ||
| zip -r "${OLDPWD}/dmuart_port-${TAG}-${CPU}.zip" . | ||
| cd - | ||
|
|
||
| echo "Created archives:" | ||
| ls -lh dmuart-*.zip dmuart_port-*.zip | ||
|
|
||
| - name: Upload dmuart and dmuart_port artifacts | ||
| uses: actions/upload-artifact@v4.4.3 | ||
| with: | ||
| name: ${{ env.ARTIFACT_NAME }} | ||
| path: "dmuart*.zip" | ||
| retention-days: 1 | ||
|
|
||
| generate-versions-manifest: | ||
| name: Generate versions.dmm | ||
| needs: [discover-cpu-families] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Fetch all history to get all tags | ||
|
|
||
| - name: Generate versions.dmm | ||
| run: | | ||
| set -e | ||
| echo "# List of available versions for dmuart modules" > versions.dmm | ||
| echo "# Generated automatically by CI" >> versions.dmm | ||
| echo "" >> versions.dmm | ||
|
|
||
| # Get all version tags (starting with 'v') and extract version numbers | ||
| VERSIONS=$(git tag -l 'v*' | sed 's/^v//' | sort -V | tr '\n' ' ' | sed 's/ $//') | ||
|
|
||
| # Remove vlatest from the list if present | ||
| VERSIONS=$(echo $VERSIONS | sed 's/\blatest\b//g' | xargs) | ||
|
|
||
| if [ -z "$VERSIONS" ]; then | ||
| echo "Warning: No version tags found" | ||
| VERSIONS="${{ github.event.release.tag_name }}" | ||
| VERSIONS="${VERSIONS#v}" | ||
| fi | ||
|
|
||
| echo "Found versions: $VERSIONS" | ||
|
|
||
| # Add $version-available directives for the modules | ||
| echo "\$version-available dmuart $VERSIONS" >> versions.dmm | ||
| echo "\$version-available dmuart_port $VERSIONS" >> versions.dmm | ||
|
|
||
| echo "Generated versions.dmm:" | ||
| cat versions.dmm | ||
|
|
||
| - name: Upload versions.dmm as artifact | ||
| uses: actions/upload-artifact@v4.4.3 | ||
| with: | ||
| name: versions-manifest | ||
| path: versions.dmm | ||
| retention-days: 1 | ||
|
|
||
| upload-release-assets: | ||
| name: Upload Release Assets | ||
| needs: [build-dmuart, generate-versions-manifest] | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4.1.3 | ||
| with: | ||
| path: artifacts | ||
|
|
||
| - name: Display artifact structure | ||
| run: | | ||
| echo "Downloaded artifacts:" | ||
| ls -lR artifacts/ | ||
|
|
||
| - name: Upload release assets to versioned tag | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -e | ||
| # Upload all release archives to the GitHub release | ||
| shopt -s nullglob | ||
| zip_files=(artifacts/release-*/*.zip) | ||
|
|
||
| if [ ${#zip_files[@]} -eq 0 ]; then | ||
| echo "Error: No artifacts found to upload" | ||
| exit 1 | ||
| fi | ||
|
|
||
| for zip_file in "${zip_files[@]}"; do | ||
| echo "Uploading $zip_file to ${{ github.event.release.tag_name }}..." | ||
| gh release upload ${{ github.event.release.tag_name }} \ | ||
| "$zip_file" \ | ||
| --repo ${{ github.repository }} \ | ||
| --clobber | ||
| done | ||
|
|
||
| # Upload versions.dmm to the versioned release | ||
| if [ -f artifacts/versions-manifest/versions.dmm ]; then | ||
| echo "Uploading versions.dmm to ${{ github.event.release.tag_name }}..." | ||
| gh release upload ${{ github.event.release.tag_name }} \ | ||
| artifacts/versions-manifest/versions.dmm \ | ||
| --repo ${{ github.repository }} \ | ||
| --clobber | ||
| fi | ||
|
|
||
| echo "Successfully uploaded ${#zip_files[@]} artifact(s) to ${{ github.event.release.tag_name }}" | ||
|
|
||
| - name: Create or update latest release | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -e | ||
|
|
||
| # Check if vlatest release exists | ||
| if gh release view vlatest --repo ${{ github.repository }} >/dev/null 2>&1; then | ||
| echo "Release vlatest exists, deleting it..." | ||
| gh release delete vlatest --repo ${{ github.repository }} --yes | ||
| fi | ||
|
|
||
| # Create new vlatest release | ||
| echo "Creating vlatest release..." | ||
| gh release create vlatest \ | ||
| --repo ${{ github.repository }} \ | ||
| --title "Latest Release (based on ${{ github.event.release.tag_name }})" \ | ||
| --notes "This release always points to the latest stable version. Currently based on ${{ github.event.release.tag_name }}." | ||
|
|
||
| - name: Upload release assets to latest tag | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -e | ||
| shopt -s nullglob | ||
| zip_files=(artifacts/release-*/*.zip) | ||
|
|
||
| for zip_file in "${zip_files[@]}"; do | ||
| echo "Uploading $zip_file to vlatest..." | ||
| gh release upload vlatest \ | ||
| "$zip_file" \ | ||
| --repo ${{ github.repository }} \ | ||
| --clobber | ||
| done | ||
|
|
||
| # Upload versions.dmm to the latest release | ||
| if [ -f artifacts/versions-manifest/versions.dmm ]; then | ||
| echo "Uploading versions.dmm to vlatest..." | ||
| gh release upload vlatest \ | ||
| artifacts/versions-manifest/versions.dmm \ | ||
| --repo ${{ github.repository }} \ | ||
| --clobber | ||
| fi | ||
|
|
||
| echo "Successfully uploaded ${#zip_files[@]} artifact(s) to vlatest" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. brakuje też konfiguracji CI dla githuba
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| "files.associations": { | ||
| "dmfsi.h": "c" | ||
| }, | ||
| "C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json", | ||
| "C_Cpp.intelliSenseEngine": "default", | ||
| "C_Cpp.errorSquiggles": "enabled" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
release? Czemu tylko jedno skopiowałeś? Nie przyszło Ci do głowy, że drugie też jest potrzebne?