Skip to content

Commit 9671098

Browse files
mmaengkddejong
andauthored
Chore(ci): use build caches for CI jobs, update npm syntax (#83)
* Update github CI workflow to cache pip and npm, update npm ci command to use correct --include=optional syntax * Explicitly set EOL to be LF on checkout * Added stub requirements.txt file for pip caching * Add in other OSs and version of python * remove windows from ci workflow * downgrade versions in pre-commit for python 3.6 * Remove macos from ci Co-authored-by: Kevin DeJong <[email protected]>
1 parent c45322e commit 9671098

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text eol=lf

.github/workflows/ci.yml

+22-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
# Continous Integration
33
name: ci
44

5-
on:
6-
pull_request:
7-
branches:
8-
- master
9-
push:
10-
branches:
11-
- master
5+
on: [ push, pull_request ]
126

137
jobs:
148
build:
159
runs-on: ubuntu-18.04
10+
steps:
11+
- uses: actions/setup-python@v4
12+
with:
13+
python-version: 3.7
14+
os_build:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ ubuntu-latest ]
19+
python: [ 3.6, 3.7, 3.8, 3.9 ]
20+
node: [ 14 ]
1621
env:
1722
SAM_CLI_TELEMETRY: "0"
1823
AWS_REGION: "us-east-1"
@@ -25,7 +30,8 @@ jobs:
2530
- uses: actions/checkout@v3
2631
- uses: actions/setup-python@v4
2732
with:
28-
python-version: 3.7
33+
python-version: ${{ matrix.python }}
34+
cache: 'pip'
2935
- name: Install Dependencies Python
3036
id: install_python
3137
run: |
@@ -35,14 +41,19 @@ jobs:
3541
pip install .
3642
- uses: actions/setup-node@v3
3743
with:
38-
node-version: 14
44+
node-version: ${{ matrix.node }}
45+
cache: 'npm'
3946
- name: Install Dependencies Node.js
4047
id: install_nodejs
4148
# Touch needed because of https://github.com/aws/aws-cli/issues/2639
4249
run: |
43-
npm ci --optional
50+
npm ci --include=optional
4451
find ./node_modules/* -mtime +10950 -exec touch {} \;
4552
npm run build
53+
- uses: actions/cache@v3
54+
with:
55+
path: ~/.cache/pre-commit/
56+
key: ${{ matrix.os }}-${{ env.pythonLocation }}${{ hashFiles('.pre-commit-config.yaml') }}
4657
- name: Run Unit Tests
4758
id: unit_testing
4859
run: |
@@ -74,7 +85,7 @@ jobs:
7485
cp "$RPDK_PATH" ./dist
7586
npm install "./dist/$RPDK_PACKAGE"
7687
cfn generate -vv && cfn validate -vv
77-
npm install --optional
88+
npm install --include=optional
7889
sam build --debug --build-dir ./build TypeFunction
7990
sam build --debug --build-dir ./build TestEntrypoint
8091
sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ repos:
55
- id: isort
66
# language_version: python3.6
77
- repo: https://github.com/ambv/black
8-
rev: 22.10.0
8+
rev: 22.8.0
99
hooks:
1010
- id: black
1111
# language_version: python3.6
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v4.3.0
13+
rev: v4.1.0
1414
hooks:
1515
- id: check-case-conflict
1616
- id: end-of-file-fixer
@@ -44,7 +44,7 @@ repos:
4444
- id: python-check-mock-methods
4545
- id: python-no-log-warn
4646
- repo: https://github.com/PyCQA/bandit
47-
rev: 1.7.4
47+
rev: 1.7.1
4848
hooks:
4949
- id: bandit
5050
files: "^python/"

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-e .

0 commit comments

Comments
 (0)