forked from EyeTrackVR/OpenIris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: testing craetezip script * feat: testing craetezip script * feat: testing craetezip script * feat: testing craetezip script * feat: testing createzip script * feat: testing createzip script * chore(minor): 1.4.0-create-zip.1 [skip ci] ## [1.4.0-create-zip.1](EyeTrackVR/OpenIris@v1.3.0...v1.4.0-create-zip.1) (2023-01-31) ### 🍕 Features * testing craetezip script ([7db8063](EyeTrackVR@7db8063)) * testing craetezip script ([2584e37](EyeTrackVR@2584e37)) * testing craetezip script ([174e9ae](EyeTrackVR@174e9ae)) * testing craetezip script ([0d2b56e](EyeTrackVR@0d2b56e)) * testing createzip script ([c7d3ed7](EyeTrackVR@c7d3ed7)) * testing createzip script ([4eb4758](EyeTrackVR@4eb4758)) * feat: testing createzip script * chore(minor): 1.4.0-create-zip.2 [skip ci] ## [1.4.0-create-zip.2](EyeTrackVR/OpenIris@v1.4.0-create-zip.1...v1.4.0-create-zip.2) (2023-01-31) ### 🍕 Features * testing createzip script ([fb9c35d](EyeTrackVR@fb9c35d)) * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * feat: testing createzip script * chore(minor): 1.4.0-create-zip.3 [skip ci] ## [1.4.0-create-zip.3](EyeTrackVR/OpenIris@v1.4.0-create-zip.2...v1.4.0-create-zip.3) (2023-01-31) ### 🍕 Features * testing createzip script ([1a3ba1b](EyeTrackVR@1a3ba1b)) * testing createzip script ([3094c29](EyeTrackVR@3094c29)) * testing createzip script ([af89d4d](EyeTrackVR@af89d4d)) * testing createzip script ([35bb0f2](EyeTrackVR@35bb0f2)) * testing createzip script ([ab196c5](EyeTrackVR@ab196c5)) * testing createzip script ([c63e223](EyeTrackVR@c63e223)) * testing createzip script ([9d3fd65](EyeTrackVR@9d3fd65)) * testing createzip script ([ef652f4](EyeTrackVR@ef652f4)) * testing createzip script ([bcef340](EyeTrackVR@bcef340)) * testing createzip script ([8d4d5cc](EyeTrackVR@8d4d5cc)) * testing createzip script ([fd6ccdc](EyeTrackVR@fd6ccdc)) * fix offset order bug * fix: firmware binary bundling bug * chore(patch): 1.4.0-create-zip.4 [skip ci] ## [1.4.0-create-zip.4](EyeTrackVR/OpenIris@v1.4.0-create-zip.3...v1.4.0-create-zip.4) (2023-02-01) ### 🐛 Bug Fixes * firmware binary bundling bug ([6004cdf](EyeTrackVR@6004cdf)) * no-release: cleanup script * refactor: cleanup script * chore(patch): 1.4.0-create-zip.5 [skip ci] ## [1.4.0-create-zip.5](EyeTrackVR/OpenIris@v1.4.0-create-zip.4...v1.4.0-create-zip.5) (2023-02-02) ### 🧑💻 Code Refactoring * cleanup script ([a2202d6](EyeTrackVR@a2202d6)) * feat: add detection of environment variable * chore(minor): 1.4.0-create-zip.6 [skip ci] ## [1.4.0-create-zip.6](EyeTrackVR/OpenIris@v1.4.0-create-zip.5...v1.4.0-create-zip.6) (2023-02-02) ### 🍕 Features * add detection of environment variable ([ca8080e](EyeTrackVR@ca8080e)) * refactor: prepare for merge --------- Co-authored-by: semantic-release-bot <[email protected]>
- Loading branch information
1 parent
8932767
commit 8229a3a
Showing
8 changed files
with
183 additions
and
67 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,19 @@ on: | |
push: | ||
branches: | ||
- "master" | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "master" | ||
- "main" | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target_name: [ | ||
esp32AIThinker, | ||
esp32M5Stack, | ||
esp32Cam, | ||
esp_eye, | ||
wrover, | ||
] | ||
target_build_type: [ | ||
"", | ||
_release, | ||
_OTA, | ||
] | ||
matrix: | ||
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover] | ||
target_build_type: ["", _release, _OTA] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -40,78 +32,84 @@ jobs: | |
with: | ||
path: ~/.platformio | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
restore-keys: | | ||
${{ runner.os }}-pio- | ||
- name: Setup Python install | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
python-version: "3.x" | ||
- name: Install PlatformIO with Pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install distro | ||
pip install --upgrade platformio | ||
pio upgrade --dev | ||
pio pkg update --global | ||
- name: Update build command | ||
working-directory: ./ESP | ||
run: | | ||
sed -i '/\[env\]/p; s/\[env\]/upload_protocol = custom/' platformio.ini | ||
- name: Build OpenIris Firmware | ||
working-directory: ./ESP | ||
run: | | ||
export OPENIRIS_CI_BUILD=1 | ||
mkdir build | ||
mkdir build/${{ matrix.target_name }}${{ matrix.target_build_type }} | ||
echo "::group::platformio.ini" | ||
cat platformio.ini | ||
echo "::endgroup::" | ||
echo "::group::pio run" | ||
pio run --environment ${{ matrix.target_name }}${{ matrix.target_build_type }} | ||
#- name: Archive Version File | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: version | ||
# path: ./ESP/tools/version.txt | ||
echo "::endgroup::" | ||
unzip -l './build/${{ matrix.target_name }}${{ matrix.target_build_type }}/*.zip' | ||
- name: Archive Firmware name File | ||
# create an environment variable with the name of the firmware file by catting the firmware_name.txt file | ||
run: | | ||
echo "FIRMWARE_NAME=$(cat ./ESP/tools/firmware_name.txt)" >> $GITHUB_ENV | ||
- name: Archive Firmware Files | ||
- name: Archive Firmware Binaries | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
with: | ||
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware | ||
path: "./ESP/.pio/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.bin" | ||
#path: "./ESP/.pio/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.bin" | ||
path: "./ESP/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.zip" | ||
retention-days: 5 | ||
if-no-files-found: error | ||
release-openiris: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create Directory | ||
run: mkdir -p build | ||
- name: Download Firmware Files | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: build/ | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm install -g conventional-changelog-conventionalcommits | ||
- run: npm install -g [email protected] | ||
- run: npm install -g @semantic-release/exec | ||
- run: npm install -g @semantic-release/git | ||
- run: npm install -g @semantic-release/release-notes-generator | ||
- run: npm install -g @semantic-release/changelog | ||
- run: npm install -g @semantic-release/github | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: semantic-release | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Create Directory | ||
run: mkdir -p build | ||
- name: Download Firmware Files | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: build/ | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm install -g conventional-changelog-conventionalcommits | ||
- run: npm install -g [email protected] | ||
- run: npm install -g @semantic-release/exec | ||
- run: npm install -g @semantic-release/git | ||
- run: npm install -g @semantic-release/release-notes-generator | ||
- run: npm install -g @semantic-release/changelog | ||
- run: npm install -g @semantic-release/github | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: semantic-release | ||
cleanup: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target_name: [ | ||
esp32AIThinker, | ||
esp32M5Stack, | ||
esp32Cam, | ||
esp_eye, | ||
wrover, | ||
] | ||
target_build_type: [ | ||
"", | ||
_release, | ||
_OTA, | ||
] | ||
matrix: | ||
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover] | ||
target_build_type: ["", _release, _OTA] | ||
name: Cleanup actions | ||
needs: | ||
- release-openiris | ||
|
@@ -121,4 +119,4 @@ jobs: | |
- name: "♻️ remove build artifacts" | ||
uses: geekyeggo/delete-artifact@v1 | ||
with: | ||
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware | ||
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
Import("env") | ||
|
||
import sys | ||
import os | ||
from ntpath import basename | ||
from zipfile import ZipFile | ||
import json | ||
|
||
|
||
def createZip(source, target, env): | ||
if os.getenv("OPENIRIS_CI_BUILD", False): | ||
if sys.platform.lower().startswith(("ubuntu", "linux")): | ||
print("Program has been built, creating zip archive!") | ||
program_path = target[0].get_abspath() | ||
|
||
array_args = [env["FLASH_EXTRA_IMAGES"]] | ||
|
||
for offset, image in env["FLASH_EXTRA_IMAGES"]: | ||
print("\nImage: %s" % str(image)) | ||
array_args.extend([str(offset), str(image)]) | ||
|
||
array_args.append(env["ESP32_APP_OFFSET"]) | ||
array_args.append(program_path) | ||
|
||
n = 2 | ||
partitions_arg = array_args[1:] | ||
print(f"partitions_args: {partitions_arg}") | ||
partitions = final = [ | ||
partitions_arg[i * n : (i + 1) * n] | ||
for i in range((len(partitions_arg) + n - 1) // n) | ||
] | ||
print(f"partitions: {partitions}") | ||
file_name = "./build/{0}/{1}.zip".format( | ||
str(env["PIOENV"]), env["PROGNAME"] | ||
) | ||
with ZipFile(file_name, "w") as archive: | ||
print('\nCreating "' + archive.filename + '"', end="\n") | ||
parts = [] | ||
for [offset, path] in partitions: | ||
filename = basename(path) | ||
archive.write(path, filename) | ||
partition = { | ||
"path": filename, | ||
"offset": int(offset, 16), | ||
} | ||
parts.append(partition) | ||
manifest = { | ||
"chipFamily": "ESP32", | ||
"parts": parts, | ||
} | ||
archive.writestr("manifest.json", json.dumps(manifest)) | ||
else: | ||
print("Not running on Linux, skipping zip creation") | ||
else: | ||
print("CI build not detected, skipping zip creation") | ||
|
||
|
||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", createZip) |