diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e3844f..4d92eb6 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest ] - python: [ 3.6, 3.7, 3.8, 3.9 ] + os: [ ubuntu-latest, macos-latest ] + python: [ 3.7, 3.8, 3.9 ] node: [ 14 ] env: SAM_CLI_TELEMETRY: "0" @@ -26,8 +26,39 @@ jobs: AWS_SECRET_ACCESS_KEY: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" LOG_PATH: /tmp/debug-logs PIP_LOG_FILE: /tmp/pip.log + HOMEBREW_NO_AUTO_UPDATE: 1 steps: - uses: actions/checkout@v3 + - name: Update Homebrew and save docker version + if: runner.os == 'macOS' + run: | + brew update --preinstall + cat "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/docker.rb" > .github/brew-formulae + - name: Configure Homebrew docker cache files + uses: actions/cache@v3 + if: runner.os == 'macOS' + with: + path: | + ~/Library/Caches/Homebrew/docker--* + ~/Library/Caches/Homebrew/downloads/*--docker-* + key: brew-${{ hashFiles('.github/brew-formulae') }} + restore-keys: brew- + - name: Install Docker if on MacOS and start colima + id: install_mac_docker + if: runner.os == 'macOS' + run: | + brew install docker + # Docker engine is no longer available because of licensing + # Alternative Colima is part of the github macOS runner + # SAM v1.47.0+ needed for colima support, unable to use Python 3.6 + colima start + # Ensure colima is configured for later user + echo "DOCKER_HOST=unix://$HOME/.colima/default/docker.sock" >> $GITHUB_ENV + # Verify Docker + docker ps + docker --version + # Verify colima + colima status - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} @@ -75,11 +106,12 @@ jobs: run: | RPDK_PACKAGE=$(npm pack --silent) RPDK_PATH=$PWD/$RPDK_PACKAGE - DIR=$(mktemp -d) + DIR=TestCI + mkdir $DIR cd "$DIR" - echo "PROJECT_DIR=$DIR" >> $GITHUB_ENV + echo "PROJECT_DIR=$PWD" >> $GITHUB_ENV ls -la - printf "n" | cfn init -vv --artifact-type RESOURCE --type-name AWS::Foo::Bar + printf "n" | cfn init -vv --artifact-type RESOURCE --type-name AWS::Foo::Bar typescript ls -la mkdir ./dist cp "$RPDK_PATH" ./dist @@ -88,7 +120,7 @@ jobs: npm install --include=optional sam build --debug --build-dir ./build TypeFunction sam build --debug --build-dir ./build TestEntrypoint - sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint + sam local invoke -t ./build/template.yaml --debug --event ./sam-tests/create.json --log-file ./sam.log TestEntrypoint grep -q '"status":"SUCCESS"' sam.log - name: Gather Debug Logs id: gather_logs