Skip to content

Commit

Permalink
chore(ci): improve caching for dependencies in pr-validation workflow (
Browse files Browse the repository at this point in the history
…apache#1311)

* chore(ci): improve caching for dependencies in pr-validation workflow

* chore(ci): improve caching for dependencies in python-docs workflow

* chore(ci): improve pypi-deployment workflow

* chore(ci): improve caching of dependencies for cypress-test workflow

* chore(ci): improve caching of dependencies for build workflow
  • Loading branch information
bossenti committed Feb 24, 2023
1 parent 0811e99 commit 8a013b5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: ui/package-lock.json

- name: Build with Maven
run: mvn clean verify
Expand Down Expand Up @@ -70,9 +73,7 @@ jobs:
- name: Build UI
working-directory: ./ui
run: |
NODE_PATH=/cache/node_modules
NODE_OPTIONS=--max_old_space_size=6096
npm install --unsafe-perm --legacy-peer-deps
npm install
npm run build
- name: Build and Push Docker UI Image
Expand Down Expand Up @@ -138,4 +139,3 @@ jobs:
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
push: true
tags: ${{ env.DOCKERHUB_APACHE_REPO }}/sources-watertank-simulator:${{ env.MVN_VERSION }}

7 changes: 4 additions & 3 deletions .github/workflows/cypress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: ui/package-lock.json

- name: Build UI
working-directory: ./ui
run: |
NODE_PATH=/cache/node_modules
NODE_OPTIONS=--max_old_space_size=6096
npm install --unsafe-perm --legacy-peer-deps
npm install
npm run build
- name: Build with Maven
Expand Down
56 changes: 24 additions & 32 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: validate-pr
name: PR validation

on:
pull_request:
Expand All @@ -30,6 +30,7 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Validate java code
run: mvn clean verify
Expand All @@ -44,13 +45,13 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: ui/package-lock.json

- name: Install dependencies
working-directory: ./ui
run: |
NODE_PATH=/cache/node_modules
NODE_OPTIONS=--max_old_space_size=6096
npm install --unsafe-perm --legacy-peer-deps
npm install
- name: Format and Lint all files
working-directory: ./ui
Expand All @@ -70,18 +71,23 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
cache-dependency-path: ui/package-lock.json

- name: Install NPM dependencies
working-directory: ./ui
run: |
npm install
- name: Build UI
working-directory: ./ui
run: |
NODE_PATH=/cache/node_modules
NODE_OPTIONS=--max_old_space_size=6096
npm install --unsafe-perm --legacy-peer-deps
npm run build
- name: Build with Maven
Expand Down Expand Up @@ -112,25 +118,18 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
cache: 'pip'

- name: Install Python dependencies
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[dev]"
- name: Run style & code checks
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
make pre-commit
make mypy
make lint
Expand All @@ -150,25 +149,18 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~~.cache/pip
key: ${{ runner.os }}-${{ matrix.python }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-pip-
cache: 'pip'

- name: Install Python dependencies
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[dev]"
- name: Run unit-tests
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
make unit-tests
python-doc-checks:
Expand All @@ -181,22 +173,22 @@ jobs:
with:
python-version: 3.8

- name: Cache Python dependencies
- name: Cache Python doc dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-doc-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-doc-
- name: Install Python dependencies
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[docs]"
- name: Build MkDocs
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
make doc
4 changes: 2 additions & 2 deletions .github/workflows/pypi-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
python-version: 3.8

- name: Install dependencies
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m pip install --upgrade pip
pip install build twine
- name: Build package
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m build
twine check --strict dist/*
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/python-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
- cron: "0 2 * * 6" # runs every saturday at 00:00:00

jobs:
python-docs:
python-docs-artifact-building:
runs-on: ubuntu-latest
steps:
- name: clone
Expand All @@ -35,20 +35,20 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-doc-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-pip-doc-
- name: Install Python dependencies
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[docs]"
- name: Build Python docs
working-directory: ./streampipes-client-python
run: |
cd ./streampipes-client-python
make doc
- name: Publish Python docs as artifact
Expand Down

0 comments on commit 8a013b5

Please sign in to comment.