Skip to content

Commit

Permalink
Improved Pip caching and setup in the CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gabryelreyes committed Aug 5, 2024
1 parent 6bc1dd1 commit a33dda5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 76 deletions.
99 changes: 23 additions & 76 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,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 +64,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 +88,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 +115,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 +144,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
2 changes: 2 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
platformio==6.1.15
pylint==3.2.6

0 comments on commit a33dda5

Please sign in to comment.