Trying to fix Android build #452
This file contains hidden or 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: Build, Release and Deploy | |
| on: [ push ] | |
| permissions: write-all | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clean up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| df -h # Zeigt freien Speicher | |
| - name: Prepare and checkout | |
| uses: actions/checkout@v6 | |
| - name: Set environment variables | |
| run: echo "VERSION=$(cat version)" >> $GITHUB_ENV | |
| - name: Fail if Git-Tag already exist on main | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| TAG="v${{ env.VERSION }}" | |
| git fetch | |
| if git rev-parse -q --verify "refs/tags/${TAG}" > /dev/null; then | |
| echo "Tag ${TAG} already exists" | |
| exit 1 | |
| else | |
| echo "Tag ${TAG} does not exist" | |
| fi | |
| - name: Remove old artifacts | |
| uses: c-hive/gha-remove-artifacts@v1 | |
| with: | |
| age: '90 seconds' | |
| skip-recent: 3 | |
| - name: Initialize Submodules | |
| run: | | |
| git submodule update --init --recursive | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push docker development image | |
| if: github.ref == 'refs/heads/dev' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./endpoint | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| file: ./endpoint/Dockerfile_dev | |
| tags: christld/macless-haystack:latest-dev,christld/macless-haystack:v${{ env.VERSION }}-${{ github.sha }}, | |
| - name: Build and push docker main image | |
| if: github.ref == 'refs/heads/main' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: "{{defaultContext}}:endpoint" | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: christld/macless-haystack:latest,christld/macless-haystack:v${{ env.VERSION }}, | |
| - name: Install ARM Toolchain | |
| uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
| with: | |
| release: '10-2020-q4' | |
| - uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| cache: 'gradle' | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| cache: true | |
| channel: stable | |
| - name: Cache Flutter | |
| uses: actions/cache@v5 | |
| id: flutter-cache | |
| with: | |
| path: | | |
| ~/.pub-cache | |
| ~/.gradle/caches | |
| ./macless_haystack/.dart_tool | |
| ./macless_haystack/build/web | |
| key: flutter-${{ runner.os }}-${{ hashFiles('macless_haystack/pubspec.lock') }} | |
| - name: Android Build | |
| working-directory: ./macless_haystack | |
| env: | |
| GRADLE_OPTS: "-Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.caching=true" | |
| run: | | |
| if [ "${{ steps.flutter-cache.outputs.cache-hit }}" != "true" ]; then | |
| flutter pub get | |
| fi | |
| flutter test | |
| flutter build apk --release --build-name=${{ env.VERSION }} | |
| mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/android-application.apk | |
| - name: Upload Android Artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: android-application | |
| path: ./macless_haystack/build/app/outputs/flutter-apk/android-application.apk | |
| - name: GH-Page Build | |
| working-directory: ./macless_haystack | |
| run: | | |
| if [ "${{ steps.flutter-cache.outputs.cache-hit }}" != "true" ]; then | |
| flutter pub get | |
| fi | |
| flutter build web --profile --base-href "/macless-haystack/" | |
| - name: Deploy to Github Pages | |
| if: github.ref == 'refs/heads/dev' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: ./macless_haystack/build/web | |
| - name: Web Build | |
| working-directory: ./macless_haystack | |
| run: | | |
| if [ "${{ steps.flutter-cache.outputs.cache-hit }}" != "true" ]; then | |
| flutter pub get | |
| fi | |
| flutter build web --release | |
| - name: Copy files to web application | |
| run: | | |
| mkdir -p ./macless_haystack/build/webapplication | |
| cp -R ./macless_haystack/build/web ./macless_haystack/build/webapplication | |
| cd ./macless_haystack/build/webapplication | |
| zip -r webapplication.zip . | |
| - name: Upload Web Artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: webapplication | |
| path: ./macless_haystack/build/webapplication | |
| - name: Cache Nordic DEB | |
| uses: actions/cache@v5 | |
| id: nrf-cache | |
| with: | |
| path: /tmp/nrf-cache | |
| key: nrf-toolchain-10.23.0-amd64-deb | |
| - name: Install Nordic Toolchain | |
| run: | | |
| mkdir -p /tmp/nrf-cache | |
| if [ ! -f "/tmp/nrf-cache/nrf-command-line-tools_10.23.0_amd64.deb" ]; then | |
| echo "Downloading Nordic Toolchain..." | |
| wget -q https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-23-0/nrf-command-line-tools_10.23.0_amd64.deb -O /tmp/nrf-cache/nrf-command-line-tools_10.23.0_amd64.deb | |
| else | |
| echo "Using cached DEB file" | |
| fi | |
| sudo dpkg -i /tmp/nrf-cache/nrf-command-line-tools_10.23.0_amd64.deb | |
| echo "/opt/nordic/nrf-command-line-tools/bin" >> $GITHUB_PATH | |
| - name: Build NRF5x firmware | |
| run: | | |
| cd firmware/nrf5x/ | |
| make build | |
| make clean | |
| NRF_MODEL=nrf51 make build | |
| - name: Upload NRF5x firmware | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: nrf5x-firmware | |
| path: | | |
| firmware/nrf5x/compiled/*.bin | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.14' | |
| cache: 'pip' | |
| - name: Install PlatformIO Core | |
| run: | | |
| pip install --upgrade platformio | |
| pip install idf-component-manager | |
| - name: Build ESP32 firmware | |
| run: | | |
| pio pkg list --project-dir firmware/ESP32/ | |
| pio run -d firmware/ESP32/ | |
| cd firmware/ESP32/.pio/build/esp32dev/ | |
| zip -r esp32-firmware.zip firmware.bin partitions.bin bootloader.bin | |
| - name: Upload ESP32 firmware | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: esp32-firmware | |
| path: | | |
| firmware/ESP32/.pio/build/esp32dev/firmware.bin | |
| firmware/ESP32/.pio/build/esp32dev/partitions.bin | |
| firmware/ESP32/.pio/build/esp32dev/bootloader.bin | |
| - name: Delete old drafts | |
| uses: hugo19941994/delete-draft-releases@v1.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: v${{ env.VERSION }} | |
| title: v${{ env.VERSION }} | |
| draft: true | |
| prerelease: false | |
| files: | | |
| generate_keys.py | |
| firmware/ESP32/.pio/build/esp32dev/esp32-firmware.zip | |
| firmware/nrf5x/compiled/*.bin | |
| ./macless_haystack/build/app/outputs/flutter-apk/android-application.apk |