From 8281d61ef41e0382a4a80debcc2e41195a0b4538 Mon Sep 17 00:00:00 2001 From: David Schinazi Date: Thu, 18 Jul 2024 15:58:46 -0700 Subject: [PATCH] Refactor PlatformIO setup in actions --- .github/workflows/jazzlights.yml | 27 +++++--------------------- .github/workflows/setup-platformio.yml | 21 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/setup-platformio.yml diff --git a/.github/workflows/jazzlights.yml b/.github/workflows/jazzlights.yml index 894fa24a..5f792d4d 100644 --- a/.github/workflows/jazzlights.yml +++ b/.github/workflows/jazzlights.yml @@ -37,18 +37,7 @@ jobs: platformio: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - ~/.platformio/.cache - key: ${{ runner.os }}-pio - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Install PlatformIO Core - run: pip install --upgrade platformio + - uses: ./.github/workflows/setup-platformio.yml - name: PlatformIO Build run: pio run - name: PlatformIO Test @@ -72,19 +61,13 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: ./.github/workflows/setup-platformio.yml - uses: actions/cache@v4 with: - path: | - ~/.cache/pip - ~/.platformio/.cache - key: ${{ runner.os }}-pio - - uses: actions/setup-python@v5 - with: - python-version: "3.12" + path: ~/.cache/pip + key: ${{ runner.os }}-pip - name: Install Python Dependencies - run: pip install --upgrade platformio beautifulsoup4 lxml + run: pip install --upgrade beautifulsoup4 lxml - uses: ruby/setup-ruby@v1 with: ruby-version: "3.3" diff --git a/.github/workflows/setup-platformio.yml b/.github/workflows/setup-platformio.yml new file mode 100644 index 00000000..72498b74 --- /dev/null +++ b/.github/workflows/setup-platformio.yml @@ -0,0 +1,21 @@ +name: Checks out code, sets up PlatformIO and its dependencies + +on: + workflow_call: + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install PlatformIO Core + run: pip install --upgrade platformio