Bump actions/checkout from 3 to 4 #594
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
# Checks whether the pushed commit can be build with PIO. Only triggered on normal push to the mega branch without tag and with pull requests targeting mega | |
name: Build | |
on: | |
push: | |
branches: [mega] | |
tags-ignore: '**' | |
paths-ignore: | |
- 'dist/Release_notes.txt' | |
pull_request: | |
branches: [mega] | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
documentation: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }} | |
- name: Build documentation | |
run: | | |
cd docs | |
sudo apt install imagemagick zip | |
pip install -r requirements.txt | |
make html | |
cd .. | |
zip -r -qq ESPEasy_docs.zip docs/build/* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Documentation | |
path: ESPEasy_docs.zip | |
generate-matrix: | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- id: set-matrix | |
run: | | |
pip install platformio | |
python tools/ci/generate-matrix.py | |
build: | |
needs: generate-matrix | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ hashFiles('requirements.txt') }} | |
- uses: actions/cache@v3 | |
if: ${{ contains(matrix.env, 'esp32') }} | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-esp32-${{ hashFiles('platformio*.ini') }} | |
- uses: actions/cache@v3 | |
if: ${{ contains(matrix.env, 'esp8266') }} | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-esp8266-${{ hashFiles('platformio*.ini') }} | |
- name: Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install binutils build-essential libffi-dev libgit2-dev | |
pip3 install --upgrade pip | |
pip install -r requirements.txt | |
platformio update | |
- name: Build and archive | |
id: build-and-archive | |
env: | |
CHIP: ${{ matrix.chip }} | |
ENV: ${{ matrix.env }} | |
run: | | |
python tools/ci/build-and-archive.py | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Binaries | |
path: | | |
bin | |
if-no-files-found: ignore | |
# Repackage separately for ESP82xx and ESP32 | |
repackage: | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }} | |
- name: Get current date | |
id: date | |
run: | | |
echo "builddate=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts/ | |
- name: Prepare artifacts | |
run: | | |
mkdir ESPEasy_dist_ESP82xx | |
mkdir ESPEasy_dist_ESP32 | |
cd dist | |
find . -exec cp -r --parents {} ../ESPEasy_dist_ESP82xx/ \; | |
find . -exec cp -r --parents {} ../ESPEasy_dist_ESP32/ \; | |
cd .. | |
cd ESPEasy_dist_ESP32 | |
rm ESP.Easy.Flasher.exe bin/blank_1MB.bin bin/blank_2MB.bin bin/ESPEasy_2step_UploaderMega_1024.bin | |
cd .. | |
cd artifacts/Binaries | |
find . -not -name '*ESP32*' -exec mv {} ../../ESPEasy_dist_ESP82xx/bin/ \; | |
find . -name '*ESP32*' -exec mv {} ../../ESPEasy_dist_ESP32/bin/ \; | |
cd ../.. | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32_PR#${{ github.event.number }}_${{ github.run_id }} | |
path: | | |
ESPEasy_dist_ESP32/* | |
if-no-files-found: ignore | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP82xx_PR#${{ github.event.number }}_${{ github.run_id }} | |
path: | | |
ESPEasy_dist_ESP82xx/* | |
if-no-files-found: ignore | |
# When successfully re-packaged, the original Binaries can be removed | |
# comment below 3 lines to not remove the Binaries artifact after repackaging | |
- uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: Binaries |