Skip to content

Commit 0b9ef64

Browse files
authored
feat(CI): add MacOS CI testing (#88)
* Add in MacOS CI testing * add comments; more explicit paths in sam command * Remove Python 3.6 from CI testing, incompatible
1 parent 9671098 commit 0b9ef64

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
os: [ ubuntu-latest ]
19-
python: [ 3.6, 3.7, 3.8, 3.9 ]
18+
os: [ ubuntu-latest, macos-latest ]
19+
python: [ 3.7, 3.8, 3.9 ]
2020
node: [ 14 ]
2121
env:
2222
SAM_CLI_TELEMETRY: "0"
@@ -26,8 +26,39 @@ jobs:
2626
AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
2727
LOG_PATH: /tmp/debug-logs
2828
PIP_LOG_FILE: /tmp/pip.log
29+
HOMEBREW_NO_AUTO_UPDATE: 1
2930
steps:
3031
- uses: actions/checkout@v3
32+
- name: Update Homebrew and save docker version
33+
if: runner.os == 'macOS'
34+
run: |
35+
brew update --preinstall
36+
cat "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/docker.rb" > .github/brew-formulae
37+
- name: Configure Homebrew docker cache files
38+
uses: actions/cache@v3
39+
if: runner.os == 'macOS'
40+
with:
41+
path: |
42+
~/Library/Caches/Homebrew/docker--*
43+
~/Library/Caches/Homebrew/downloads/*--docker-*
44+
key: brew-${{ hashFiles('.github/brew-formulae') }}
45+
restore-keys: brew-
46+
- name: Install Docker if on MacOS and start colima
47+
id: install_mac_docker
48+
if: runner.os == 'macOS'
49+
run: |
50+
brew install docker
51+
# Docker engine is no longer available because of licensing
52+
# Alternative Colima is part of the github macOS runner
53+
# SAM v1.47.0+ needed for colima support, unable to use Python 3.6
54+
colima start
55+
# Ensure colima is configured for later user
56+
echo "DOCKER_HOST=unix://$HOME/.colima/default/docker.sock" >> $GITHUB_ENV
57+
# Verify Docker
58+
docker ps
59+
docker --version
60+
# Verify colima
61+
colima status
3162
- uses: actions/setup-python@v4
3263
with:
3364
python-version: ${{ matrix.python }}
@@ -75,11 +106,12 @@ jobs:
75106
run: |
76107
RPDK_PACKAGE=$(npm pack --silent)
77108
RPDK_PATH=$PWD/$RPDK_PACKAGE
78-
DIR=$(mktemp -d)
109+
DIR=TestCI
110+
mkdir $DIR
79111
cd "$DIR"
80-
echo "PROJECT_DIR=$DIR" >> $GITHUB_ENV
112+
echo "PROJECT_DIR=$PWD" >> $GITHUB_ENV
81113
ls -la
82-
printf "n" | cfn init -vv --artifact-type RESOURCE --type-name AWS::Foo::Bar
114+
printf "n" | cfn init -vv --artifact-type RESOURCE --type-name AWS::Foo::Bar typescript
83115
ls -la
84116
mkdir ./dist
85117
cp "$RPDK_PATH" ./dist
@@ -88,7 +120,7 @@ jobs:
88120
npm install --include=optional
89121
sam build --debug --build-dir ./build TypeFunction
90122
sam build --debug --build-dir ./build TestEntrypoint
91-
sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint
123+
sam local invoke -t ./build/template.yaml --debug --event ./sam-tests/create.json --log-file ./sam.log TestEntrypoint
92124
grep -q '"status":"SUCCESS"' sam.log
93125
- name: Gather Debug Logs
94126
id: gather_logs

0 commit comments

Comments
 (0)