Skip to content

Commit

Permalink
ci(GitHub): use env build flags
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Aug 4, 2024
1 parent 004c615 commit 17e97bf
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ jobs:
coverage: false
battery_flag: SS_BATTERY_ENABLED=true
nimble_flag: SS_USE_NIMBLE=true
env:
PLATFORMIO_BUILD_FLAGS: ${{ matrix.coverage && '-lgcov --coverage' || '' }} ${{ matrix.battery_flag }} ${{ matrix.nimble_flag }}

steps:
- uses: actions/checkout@v4
Expand All @@ -70,26 +72,6 @@ jobs:
run: |
./.github/scripts/get_firmware_name.sh ${{ matrix.target }} ${{ matrix.battery_flag }} ${{ matrix.nimble_flag }}
- name: Enable coverage (non-macOS)
if: runner.os != 'macOS' && matrix.coverage
run: |
sed -i '/__OH_FIRMWARE__/p; s/-D __OH_FIRMWARE__/-lgcov --coverage/' platformio.ini
- name: Enable coverage (macOS)
if: runner.os == 'macOS' && matrix.coverage
run: |
sed -i '' '/__OH_FIRMWARE__/p; s/-D __OH_FIRMWARE__/-lgcov --coverage/' platformio.ini
- name: Update build flags (non-macOS)
if: runner.os != 'macOS'
run: |
sed -i '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.battery_flag }}/' platformio.ini
sed -i '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.nimble_flag }}/' platformio.ini
- name: Update build flags (macOS)
if: runner.os == 'macOS'
run: |
sed -i '' '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.battery_flag }}/' platformio.ini
sed -i '' '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.nimble_flag }}/' platformio.ini
- name: Speedup package installation
if: matrix.coverage
uses: abbbi/github-actions-tune@v1
Expand Down Expand Up @@ -242,6 +224,9 @@ jobs:
comm_flag: OPENGLOVES_COMMUNICATION=OPENGLOVES_COMM_BLESERIAL
coverage: true

env:
PLATFORMIO_BUILD_FLAGS: ${{ matrix.coverage && '-lgcov --coverage' || '' }} ${{ matrix.comm_flag }} ${{ matrix.curl_calibration_flag }}

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -284,26 +269,6 @@ jobs:
with:
python-version: "3.9"

- name: Enable coverage (non-macOS)
if: runner.os != 'macOS' && matrix.coverage
run: |
sed -i '/__OH_FIRMWARE__/p; s/-D __OH_FIRMWARE__/-lgcov --coverage/' platformio.ini
- name: Enable coverage (macOS)
if: runner.os == 'macOS' && matrix.coverage
run: |
sed -i '' '/__OH_FIRMWARE__/p; s/-D __OH_FIRMWARE__/-lgcov --coverage/' platformio.ini
- name: Update build flags (non-macOS)
if: runner.os != 'macOS'
run: |
sed -i '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.curl_calibration_flag }}/' platformio.ini
sed -i '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.comm_flag }}/' platformio.ini
- name: Update build flags (macOS)
if: runner.os == 'macOS'
run: |
sed -i '' '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.curl_calibration_flag }}/' platformio.ini
sed -i '' '/__OH_FIRMWARE__/p; s/__OH_FIRMWARE__/${{ matrix.comm_flag }}/' platformio.ini
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -639,6 +604,7 @@ jobs:
with:
filePath: memory-usage-comparison.md
comment_tag: memory-usage-comparison

wokwi:
needs:
- build-bhaptics
Expand Down

0 comments on commit 17e97bf

Please sign in to comment.