Skip to content

Commit

Permalink
Merge pull request #144 from BlueAndi/ci/improvement
Browse files Browse the repository at this point in the history
Improve CI caching
  • Loading branch information
gabryelreyes authored Aug 5, 2024
2 parents 6bc1dd1 + e28aaff commit 8aa973f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 78 deletions.
115 changes: 37 additions & 78 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ name: main
on:
push:
branches: [ '**' ]
pull_request:
branches: [ main ]
release:
# A release, pre-release, or draft of a release is published.
types: [ published ]
Expand All @@ -23,6 +21,20 @@ jobs:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "The name of the branch is ${{ github.ref }} and the repository is ${{ github.repository }}."

- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
pip install -r .github/workflows/requirements.txt
# Build all targets
build:
# The type of runner that the job will run on.
Expand All @@ -37,29 +49,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt
- name: Compile ${{ matrix.environment }} firmware
run: platformio run --environment ${{ matrix.environment }}
Expand All @@ -77,29 +76,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt
- name: Perform static checks on ${{ matrix.environment }}
run: platformio check --environment ${{ matrix.environment }} --fail-on-defect=medium --fail-on-defect=high
Expand All @@ -114,29 +100,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install PlatformIO
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt
- name: Run tests on native environment
run: platformio test --environment TestSim -vvv
Expand All @@ -154,29 +127,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install PlatformIO
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install -r .github/workflows/requirements.txt
- name: Set up graphviz
uses: ts-graphviz/setup-graphviz@v2
Expand All @@ -196,23 +156,22 @@ jobs:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
needs: intro
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

# Steps represent a sequence of tasks that will be executed as part of the job.
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

python-version: '3.9'
cache: 'pip'
cache-dependency-path: .github/workflows/requirements.txt

- name: Install dependencies
run: |
pip install pylint
pip install -r .github/workflows/requirements.txt
- name: Analysing the code with pylint
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
platformio==6.1.15
pylint==3.2.6
SerialMuxProt @ git+https://github.com/gabryelreyes/SerialMuxProt.git@10270033b0eb5e19cae39c35978745a778eb6acc#subdirectory=python/SerialMuxProt

0 comments on commit 8aa973f

Please sign in to comment.