Add continuous integration for multiple platforms #7
Workflow file for this run
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: PlatformIO CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
paxo_v5_build_test_upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Build PlatformIO Project for Paxo ESP32 | |
run: pio run -e paxo-v5 | |
# We are unable to run tests on ESP32 | |
- name: Move files into artifact directory | |
shell: bash | |
run: | | |
mkdir build | |
cp -r .pio/build/paxo-v5/firmware.bin build | |
cp -r .pio/build/paxo-v5/firmware.elf build | |
cp -r .pio/build/paxo-v5/firmware.map build | |
cp -r .pio/build/paxo-v5/bootloader.bin build | |
cp -r .pio/build/paxo-v5/partitions.bin build | |
cp -r storage build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: paxo-v5-build | |
path: | | |
build | |
linux_build_test_upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Install SDL2 | |
run: sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" && sudo apt-get update -y -qq && sudo apt-get install libsdl2-dev | |
- name: Build PlatformIO Project for Linux | |
run: pio run -e linux | |
- name: Run tests for Linux | |
run: pio test -e linux --json-output-path linux-test-report.json --junit-output-path linux-test-report.xml | |
- name: Move files into artifact directory | |
shell: bash | |
run: | | |
mkdir build | |
cp -r .pio/build/linux/program build | |
cp -r storage build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-build | |
path: | | |
build | |
- name: Upload test reports | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-test-reports | |
path: | | |
linux-test-report.json | |
linux-test-report.xml | |
macos_build_test_upload: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Install SDL2 | |
run: brew install SDL2 | |
- name: Build PlatformIO Project for macOS | |
run: DYLD_LIBRARY_PATH="`brew --prefix sdl2`/lib" pio run -e macos | |
- name: Run tests for macOS | |
run: DYLD_LIBRARY_PATH="`brew --prefix sdl2`/lib" pio test -e macos --json-output-path macos-test-report.json --junit-output-path macos-test-report.xml | |
- name: Move files into artifact directory | |
shell: bash | |
run: | | |
mkdir build | |
cp -r .pio/build/macos/program build | |
cp -r storage build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-build | |
path: | | |
build | |
- name: Upload test reports | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-test-reports | |
path: | | |
macos-test-report.json | |
macos-test-report.xml | |
windows_build_test_upload: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Build PlatformIO Project for Windows | |
run: pio run -e windows | |
- name: Run tests for Windows | |
run: pio test -e windows --json-output-path windows-test-report.json --junit-output-path windows-test-report.xml | |
- name: Move files into artifact directory | |
shell: bash | |
run: | | |
mkdir build | |
cp -r .pio/build/windows/program.exe build | |
cp -r .pio/build/windows/*.dll build | |
cp -r storage build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-build | |
path: | | |
build | |
- name: Upload test reports | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-test-reports | |
path: | | |
windows-test-report.json | |
windows-test-report.xml |