Downgrade the macOS version used for Docker tests to macos-12 to fix … #461
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Continous Integration | |
name: ci | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
os_build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-12 # Later versions of ARM-based macOS runners fail because the hypervisor framework required for Docker is not supported | |
python: [ "3.8", "3.9", "3.10", "3.11"] | |
node: [ 20 ] | |
env: | |
SAM_CLI_TELEMETRY: "0" | |
AWS_REGION: "us-east-1" | |
AWS_DEFAULT_REGION: "us-east-1" | |
AWS_ACCESS_KEY_ID: "AKIAIOSFODNN7EXAMPLE" | |
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 tap homebrew/core | |
cat "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/d/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 --cask | |
brew install colima | |
# 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 }} | |
cache: 'pip' | |
- name: Install Dependencies Python | |
id: install_python | |
run: | | |
mkdir "$LOG_PATH" | |
pip install --upgrade pip | |
pip install --upgrade setuptools wheel aws-sam-cli -r https://github.com/raw/aws-cloudformation/cloudformation-cli/master/requirements.txt | |
pip install . | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
- name: Install Dependencies Node.js | |
id: install_nodejs | |
# Touch needed because of https://github.com/aws/aws-cli/issues/2639 | |
run: | | |
npm ci --include=optional | |
find ./node_modules/* -mtime +10950 -exec touch {} \; | |
npm run build | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit/ | |
key: ${{ matrix.os }}-${{ env.pythonLocation }}${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run Unit Tests | |
id: unit_testing | |
run: | | |
pre-commit run --all-files --verbose | |
- name: Upload Coverage | |
id: codecov | |
run: | | |
curl -s https://codecov.io/bash > codecov.sh | |
bash codecov.sh -f coverage/py/coverage.xml -F unittests -n codecov-python | |
bash codecov.sh -f coverage/ts/coverage-final.json -F unittests -n codecov-typescript | |
- name: Upload Coverage Artifacts | |
id: upload_coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage/ | |
- name: Run Integration Tests | |
id: integration_testing | |
run: | | |
RPDK_PACKAGE=$(npm pack --silent) | |
RPDK_PATH=$PWD/$RPDK_PACKAGE | |
DIR=TestCI | |
mkdir $DIR | |
cd "$DIR" | |
echo "PROJECT_DIR=$PWD" >> $GITHUB_ENV | |
ls -la | |
printf "n" | cfn init -vv --artifact-type RESOURCE --type-name AWS::Foo::Bar typescript | |
ls -la | |
mkdir ./dist | |
cp "$RPDK_PATH" ./dist | |
npm install "./dist/$RPDK_PACKAGE" | |
cfn generate -vv && cfn validate -vv | |
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 | |
grep -q '"SUCCESS"' sam.log | |
- name: Gather Debug Logs | |
id: gather_logs | |
continue-on-error: true | |
if: failure() | |
run: | | |
mkdir "$LOG_PATH/_logs" 2>&1 || : | |
cp -r "$(npm config get cache)/_logs" "$LOG_PATH" 2>&1 || : | |
cp "$GITHUB_WORKSPACE/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || : | |
cp "$PROJECT_DIR/npm-debug.log" "$LOG_PATH/_logs" 2>&1 || : | |
cp "$PIP_LOG_FILE" "$LOG_PATH" 2>&1 || : | |
cp "$PROJECT_DIR/rpdk.log" "$LOG_PATH" 2>&1 || : | |
cp "$PROJECT_DIR/sam.log" "$LOG_PATH" 2>&1 || : | |
- name: Upload Debug Artifacts | |
id: upload_logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debug-logs | |
path: ${{ env.LOG_PATH }} |