たった2行でSAMのデプロイ on GitHub Actionsを高速化する
3行で説明
- GitHub Actiosで
aws-actions/setup-sam
を使うとき - runnerのOSがlinuxで、プロセッサが
x86_64
なら -
use-installer: true
を指定して、SAM CLIのインストールを爆速にしよう
setup-sam時間かかりすぎ問題
GitHub ActionsでSAMアプリケーションをデプロイする際に、runner上でSAM CLIをセットアップするために aws-actions/setup-sam
を用いている。
(ドキュメントの実装例でも登場する)
Actionsの実行結果を眺めていると、この実行に時間が結構かかっていることが分かる。
ある1回の実行では、実行全体で1m28sに対して Setup AWS SAM CLI
が34sと、1/3程度を占めていた。
実際何をしているのか見てみると、ログから分かるのは pip install
をしているだけ。
実行ログ全体
Run aws-actions/setup-sam@v2
/usr/bin/python3 --version
Python 3.10.12
/usr/bin/python3 -m venv /home/runner/work/_temp/setup-sam-EaA8cV/.venv
/home/runner/work/_temp/setup-sam-EaA8cV/.venv/bin/python -m pip install --upgrade pip
Requirement already satisfied: pip in /home/runner/work/_temp/setup-sam-EaA8cV/.venv/lib/python3.10/site-packages (22.0.2)
Collecting pip
Downloading pip-23.3.1-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 23.8 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.0.2
Uninstalling pip-22.0.2:
Successfully uninstalled pip-22.0.2
Successfully installed pip-23.3.1
/home/runner/work/_temp/setup-sam-EaA8cV/.venv/bin/python -m pip install --upgrade setuptools wheel
Requirement already satisfied: setuptools in /home/runner/work/_temp/setup-sam-EaA8cV/.venv/lib/python3.10/site-packages (59.6.0)
Collecting setuptools
Downloading setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
Collecting wheel
Downloading wheel-0.41.3-py3-none-any.whl.metadata (2.2 kB)
Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 kB 29.9 MB/s eta 0:00:00
Downloading wheel-0.41.3-py3-none-any.whl (65 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.8/65.8 kB 19.9 MB/s eta 0:00:00
Installing collected packages: wheel, setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 59.6.0
Uninstalling setuptools-59.6.0:
Successfully uninstalled setuptools-59.6.0
Successfully installed setuptools-68.2.2 wheel-0.41.3
/home/runner/work/_temp/setup-sam-EaA8cV/.venv/bin/python -m pip install cython<3.0.0 pyyaml==5.4.1 --no-build-isolation
Collecting cython<3.0.0
Downloading Cython-0.29.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (3.1 kB)
Collecting pyyaml==5.4.1
Downloading PyYAML-5.4.1.tar.gz (175 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 7.7 MB/s eta 0:00:00
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Downloading Cython-0.29.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 104.5 MB/s eta 0:00:00
Building wheels for collected packages: pyyaml
Building wheel for pyyaml (pyproject.toml): started
Building wheel for pyyaml (pyproject.toml): finished with status 'done'
Created wheel for pyyaml: filename=PyYAML-5.4.1-cp310-cp310-linux_x86_64.whl size=45656 sha256=695e501d3144c0e3dc8e907f95014400b6e132654b9e15abcb5bbfd429356cee
Stored in directory: /home/runner/.cache/pip/wheels/c7/0d/22/696ee92245ad710f506eee79bb05c740d8abccd3ecdb778683
Successfully built pyyaml
Installing collected packages: pyyaml, cython
Successfully installed cython-0.29.36 pyyaml-5.4.1
/home/runner/work/_temp/setup-sam-EaA8cV/.venv/bin/python -m pip install --upgrade aws-sam-cli==1.*
Collecting aws-sam-cli==1.*
Downloading aws_sam_cli-1.101.0-py3-none-any.whl.metadata (11 kB)
Collecting chevron~=0.12 (from aws-sam-cli==1.*)
Downloading chevron-0.14.0-py3-none-any.whl (11 kB)
Collecting click~=8.1 (from aws-sam-cli==1.*)
Downloading click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting Flask<3.1 (from aws-sam-cli==1.*)
Downloading flask-3.0.0-py3-none-any.whl.metadata (3.6 kB)
Collecting boto3<2,>=1.26.109 (from aws-sam-cli==1.*)
Downloading boto3-1.28.84-py3-none-any.whl.metadata (6.7 kB)
Collecting jmespath~=1.0.1 (from aws-sam-cli==1.*)
Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)
Collecting ruamel-yaml~=0.18.5 (from aws-sam-cli==1.*)
Downloading ruamel.yaml-0.18.5-py3-none-any.whl.metadata (23 kB)
Collecting PyYAML>=6.0.1,~=6.0 (from aws-sam-cli==1.*)
Downloading PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting cookiecutter~=2.4.0 (from aws-sam-cli==1.*)
Downloading cookiecutter-2.4.0-py3-none-any.whl.metadata (7.0 kB)
Collecting aws-sam-translator==1.79.0 (from aws-sam-cli==1.*)
Downloading aws_sam_translator-1.79.0-py3-none-any.whl.metadata (8.4 kB)
Collecting docker~=6.1.0 (from aws-sam-cli==1.*)
Downloading docker-6.1.3-py3-none-any.whl.metadata (3.5 kB)
Collecting dateparser~=1.1 (from aws-sam-cli==1.*)
Downloading dateparser-1.1.8-py2.py3-none-any.whl (293 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 293.8/293.8 kB 30.5 MB/s eta 0:00:00
Collecting requests~=2.31.0 (from aws-sam-cli==1.*)
Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting aws-lambda-builders==1.40.0 (from aws-sam-cli==1.*)
Downloading aws_lambda_builders-1.40.0-py3-none-any.whl.metadata (3.4 kB)
Collecting tomlkit==0.12.2 (from aws-sam-cli==1.*)
Downloading tomlkit-0.12.2-py3-none-any.whl.metadata (2.7 kB)
Collecting watchdog==3.0.0 (from aws-sam-cli==1.*)
Downloading watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.1/82.1 kB 26.6 MB/s eta 0:00:00
Collecting rich~=13.6.0 (from aws-sam-cli==1.*)
Downloading rich-13.6.0-py3-none-any.whl.metadata (18 kB)
Collecting pyopenssl~=23.3.0 (from aws-sam-cli==1.*)
Downloading pyOpenSSL-23.3.0-py3-none-any.whl.metadata (12 kB)
Collecting jsonschema<4.20 (from aws-sam-cli==1.*)
Downloading jsonschema-4.19.2-py3-none-any.whl.metadata (7.9 kB)
Collecting typing-extensions<5,>=4.4.0 (from aws-sam-cli==1.*)
Downloading typing_extensions-4.8.0-py3-none-any.whl.metadata (3.0 kB)
Collecting regex!=2021.10.8 (from aws-sam-cli==1.*)
Downloading regex-2023.10.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.9/40.9 kB 10.2 MB/s eta 0:00:00
Collecting tzlocal==5.2 (from aws-sam-cli==1.*)
Downloading tzlocal-5.2-py3-none-any.whl.metadata (7.8 kB)
Collecting cfn-lint~=0.83.1 (from aws-sam-cli==1.*)
Downloading cfn_lint-0.83.1-py3-none-any.whl.metadata (16 kB)
Collecting boto3-stubs==1.28.80 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading boto3_stubs-1.28.80-py3-none-any.whl.metadata (132 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.8/132.8 kB 35.6 MB/s eta 0:00:00
Requirement already satisfied: setuptools in /home/runner/work/_temp/setup-sam-EaA8cV/.venv/lib/python3.10/site-packages (from aws-lambda-builders==1.40.0->aws-sam-cli==1.*) (68.2.2)
Requirement already satisfied: wheel in /home/runner/work/_temp/setup-sam-EaA8cV/.venv/lib/python3.10/site-packages (from aws-lambda-builders==1.40.0->aws-sam-cli==1.*) (0.41.3)
Collecting pydantic<3,>=1.8 (from aws-sam-translator==1.79.0->aws-sam-cli==1.*)
Downloading pydantic-2.4.2-py3-none-any.whl.metadata (158 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 158.6/158.6 kB 36.5 MB/s eta 0:00:00
Collecting botocore<1.32.0,>=1.31.84 (from boto3<2,>=1.26.109->aws-sam-cli==1.*)
Downloading botocore-1.31.84-py3-none-any.whl.metadata (6.1 kB)
Collecting s3transfer<0.8.0,>=0.7.0 (from boto3<2,>=1.26.109->aws-sam-cli==1.*)
Downloading s3transfer-0.7.0-py3-none-any.whl.metadata (1.8 kB)
Collecting botocore-stubs (from boto3-stubs==1.28.80->boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading botocore_stubs-1.31.84-py3-none-any.whl.metadata (4.0 kB)
Collecting types-s3transfer (from boto3-stubs==1.28.80->boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading types_s3transfer-0.7.0-py3-none-any.whl.metadata (3.8 kB)
Collecting mypy-boto3-secretsmanager<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_secretsmanager-1.28.67-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-cloudformation<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_cloudformation-1.28.83-py3-none-any.whl.metadata (19 kB)
Collecting mypy-boto3-kinesis<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_kinesis-1.28.36-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-schemas<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_schemas-1.28.36-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-stepfunctions<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_stepfunctions-1.28.36-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-sts<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_sts-1.28.58-py3-none-any.whl.metadata (11 kB)
Collecting mypy-boto3-xray<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_xray-1.28.64-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-sqs<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_sqs-1.28.82-py3-none-any.whl.metadata (15 kB)
Collecting mypy-boto3-signer<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_signer-1.28.36-py3-none-any.whl.metadata (13 kB)
Collecting mypy-boto3-lambda<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_lambda-1.28.83-py3-none-any.whl.metadata (16 kB)
Collecting mypy-boto3-apigateway<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_apigateway-1.28.36-py3-none-any.whl.metadata (15 kB)
Collecting mypy-boto3-s3<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_s3-1.28.55-py3-none-any.whl.metadata (17 kB)
Collecting mypy-boto3-ecr<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_ecr-1.28.45-py3-none-any.whl.metadata (14 kB)
Collecting mypy-boto3-iam<1.29.0,>=1.28.0 (from boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading mypy_boto3_iam-1.28.79-py3-none-any.whl.metadata (22 kB)
Collecting jsonpatch (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)
Collecting networkx<4,>=2.4 (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Collecting junit-xml~=1.9 (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading junit_xml-1.9-py2.py3-none-any.whl (7.1 kB)
Collecting jschema-to-python~=1.2.3 (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading jschema_to_python-1.2.3-py3-none-any.whl (10 kB)
Collecting sarif-om~=1.0.4 (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading sarif_om-1.0.4-py3-none-any.whl (30 kB)
Collecting sympy>=1.0.0 (from cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading sympy-1.12-py3-none-any.whl (5.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 124.4 MB/s eta 0:00:00
Collecting binaryornot>=0.4.4 (from cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
Collecting Jinja2<4.0.0,>=2.7 (from cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 42.2 MB/s eta 0:00:00
Collecting python-slugify>=4.0.0 (from cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading python_slugify-8.0.1-py2.py3-none-any.whl (9.7 kB)
Collecting arrow (from cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading arrow-1.3.0-py3-none-any.whl.metadata (7.5 kB)
Collecting python-dateutil (from dateparser~=1.1->aws-sam-cli==1.*)
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 57.0 MB/s eta 0:00:00
Collecting pytz (from dateparser~=1.1->aws-sam-cli==1.*)
Downloading pytz-2023.3.post1-py2.py3-none-any.whl.metadata (22 kB)
Collecting packaging>=14.0 (from docker~=6.1.0->aws-sam-cli==1.*)
Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting urllib3>=1.26.0 (from docker~=6.1.0->aws-sam-cli==1.*)
Downloading urllib3-2.0.7-py3-none-any.whl.metadata (6.6 kB)
Collecting websocket-client>=0.32.0 (from docker~=6.1.0->aws-sam-cli==1.*)
Downloading websocket_client-1.6.4-py3-none-any.whl.metadata (7.7 kB)
Collecting Werkzeug>=3.0.0 (from Flask<3.1->aws-sam-cli==1.*)
Downloading werkzeug-3.0.1-py3-none-any.whl.metadata (4.1 kB)
Collecting itsdangerous>=2.1.2 (from Flask<3.1->aws-sam-cli==1.*)
Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB)
Collecting blinker>=1.6.2 (from Flask<3.1->aws-sam-cli==1.*)
Downloading blinker-1.7.0-py3-none-any.whl.metadata (1.9 kB)
Collecting attrs>=22.2.0 (from jsonschema<4.20->aws-sam-cli==1.*)
Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 22.3 MB/s eta 0:00:00
Collecting jsonschema-specifications>=2023.03.6 (from jsonschema<4.20->aws-sam-cli==1.*)
Downloading jsonschema_specifications-2023.7.1-py3-none-any.whl.metadata (2.8 kB)
Collecting referencing>=0.28.4 (from jsonschema<4.20->aws-sam-cli==1.*)
Downloading referencing-0.30.2-py3-none-any.whl.metadata (2.6 kB)
Collecting rpds-py>=0.7.1 (from jsonschema<4.20->aws-sam-cli==1.*)
Downloading rpds_py-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.7 kB)
Collecting cryptography<42,>=41.0.5 (from pyopenssl~=23.3.0->aws-sam-cli==1.*)
Downloading cryptography-41.0.5-cp37-abi3-manylinux_2_28_x86_64.whl.metadata (5.2 kB)
Collecting charset-normalizer<4,>=2 (from requests~=2.31.0->aws-sam-cli==1.*)
Downloading charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB)
Collecting idna<4,>=2.5 (from requests~=2.31.0->aws-sam-cli==1.*)
Downloading idna-3.4-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 20.2 MB/s eta 0:00:00
Collecting certifi>=2017.4.17 (from requests~=2.31.0->aws-sam-cli==1.*)
Downloading certifi-2023.7.22-py3-none-any.whl.metadata (2.2 kB)
Collecting markdown-it-py>=2.2.0 (from rich~=13.6.0->aws-sam-cli==1.*)
Downloading markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich~=13.6.0->aws-sam-cli==1.*)
Downloading Pygments-2.16.1-py3-none-any.whl.metadata (2.5 kB)
Collecting ruamel.yaml.clib>=0.2.7 (from ruamel-yaml~=0.18.5->aws-sam-cli==1.*)
Downloading ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (2.2 kB)
Collecting chardet>=3.0.2 (from binaryornot>=0.4.4->cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
Collecting cffi>=1.12 (from cryptography<42,>=41.0.5->pyopenssl~=23.3.0->aws-sam-cli==1.*)
Downloading cffi-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting MarkupSafe>=2.0 (from Jinja2<4.0.0,>=2.7->cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
Collecting jsonpickle (from jschema-to-python~=1.2.3->cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading jsonpickle-3.0.2-py3-none-any.whl.metadata (7.5 kB)
Collecting pbr (from jschema-to-python~=1.2.3->cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading pbr-6.0.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting six (from junit-xml~=1.9->cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich~=13.6.0->aws-sam-cli==1.*)
Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting annotated-types>=0.4.0 (from pydantic<3,>=1.8->aws-sam-translator==1.79.0->aws-sam-cli==1.*)
Downloading annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)
Collecting pydantic-core==2.10.1 (from pydantic<3,>=1.8->aws-sam-translator==1.79.0->aws-sam-cli==1.*)
Downloading pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.5 kB)
Collecting text-unidecode>=1.3 (from python-slugify>=4.0.0->cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.2/78.2 kB 25.3 MB/s eta 0:00:00
Collecting mpmath>=0.19 (from sympy>=1.0.0->cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 kB 93.5 MB/s eta 0:00:00
Collecting types-python-dateutil>=2.8.10 (from arrow->cookiecutter~=2.4.0->aws-sam-cli==1.*)
Downloading types_python_dateutil-2.8.19.14-py3-none-any.whl.metadata (1.6 kB)
Collecting types-awscrt (from botocore-stubs->boto3-stubs==1.28.80->boto3-stubs[apigateway,cloudformation,ecr,iam,kinesis,lambda,s3,schemas,secretsmanager,signer,sqs,stepfunctions,sts,xray]==1.28.80->aws-sam-cli==1.*)
Downloading types_awscrt-0.19.10-py3-none-any.whl.metadata (3.7 kB)
Collecting jsonpointer>=1.9 (from jsonpatch->cfn-lint~=0.83.1->aws-sam-cli==1.*)
Downloading jsonpointer-2.4-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting pycparser (from cffi>=1.12->cryptography<42,>=41.0.5->pyopenssl~=23.3.0->aws-sam-cli==1.*)
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.7/118.7 kB 31.1 MB/s eta 0:00:00
Downloading aws_sam_cli-1.101.0-py3-none-any.whl (5.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.5/5.5 MB 127.4 MB/s eta 0:00:00
Downloading aws_lambda_builders-1.40.0-py3-none-any.whl (130 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 130.2/130.2 kB 35.7 MB/s eta 0:00:00
Downloading aws_sam_translator-1.79.0-py3-none-any.whl (378 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 378.0/378.0 kB 81.4 MB/s eta 0:00:00
Downloading boto3-1.28.84-py3-none-any.whl (135 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 135.8/135.8 kB 43.2 MB/s eta 0:00:00
Downloading boto3_stubs-1.28.80-py3-none-any.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.2/53.2 kB 18.2 MB/s eta 0:00:00
Downloading tomlkit-0.12.2-py3-none-any.whl (37 kB)
Downloading tzlocal-5.2-py3-none-any.whl (17 kB)
Downloading cfn_lint-0.83.1-py3-none-any.whl (3.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 126.0 MB/s eta 0:00:00
Downloading click-8.1.7-py3-none-any.whl (97 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 kB 31.0 MB/s eta 0:00:00
Downloading cookiecutter-2.4.0-py3-none-any.whl (38 kB)
Downloading docker-6.1.3-py3-none-any.whl (148 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 148.1/148.1 kB 45.1 MB/s eta 0:00:00
Downloading flask-3.0.0-py3-none-any.whl (99 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.7/99.7 kB 32.4 MB/s eta 0:00:00
Downloading jsonschema-4.19.2-py3-none-any.whl (83 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.6/83.6 kB 27.1 MB/s eta 0:00:00
Downloading pyOpenSSL-23.3.0-py3-none-any.whl (58 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.8/58.8 kB 21.8 MB/s eta 0:00:00
Downloading PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 705.5/705.5 kB 97.2 MB/s eta 0:00:00
Downloading regex-2023.10.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (773 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 773.9/773.9 kB 101.0 MB/s eta 0:00:00
Downloading requests-2.31.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 17.3 MB/s eta 0:00:00
Downloading rich-13.6.0-py3-none-any.whl (239 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 239.8/239.8 kB 62.8 MB/s eta 0:00:00
Downloading ruamel.yaml-0.18.5-py3-none-any.whl (116 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.4/116.4 kB 32.7 MB/s eta 0:00:00
Downloading typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Downloading blinker-1.7.0-py3-none-any.whl (13 kB)
Downloading botocore-1.31.84-py3-none-any.whl (11.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.3/11.3 MB 127.7 MB/s eta 0:00:00
Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 158.3/158.3 kB 44.5 MB/s eta 0:00:00
Downloading charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 142.1/142.1 kB 35.8 MB/s eta 0:00:00
Downloading cryptography-41.0.5-cp37-abi3-manylinux_2_28_x86_64.whl (4.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 127.9 MB/s eta 0:00:00
Downloading jsonschema_specifications-2023.7.1-py3-none-any.whl (17 kB)
Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 27.0 MB/s eta 0:00:00
Downloading mypy_boto3_apigateway-1.28.36-py3-none-any.whl (51 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.4/51.4 kB 14.0 MB/s eta 0:00:00
Downloading mypy_boto3_cloudformation-1.28.83-py3-none-any.whl (63 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.4/63.4 kB 17.3 MB/s eta 0:00:00
Downloading mypy_boto3_ecr-1.28.45-py3-none-any.whl (36 kB)
Downloading mypy_boto3_iam-1.28.79-py3-none-any.whl (87 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.2/87.2 kB 28.6 MB/s eta 0:00:00
Downloading mypy_boto3_kinesis-1.28.36-py3-none-any.whl (31 kB)
Downloading mypy_boto3_lambda-1.28.83-py3-none-any.whl (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.6/49.6 kB 15.5 MB/s eta 0:00:00
Downloading mypy_boto3_s3-1.28.55-py3-none-any.whl (84 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.3/84.3 kB 29.6 MB/s eta 0:00:00
Downloading mypy_boto3_schemas-1.28.36-py3-none-any.whl (27 kB)
Downloading mypy_boto3_secretsmanager-1.28.67-py3-none-any.whl (25 kB)
Downloading mypy_boto3_signer-1.28.36-py3-none-any.whl (28 kB)
Downloading mypy_boto3_sqs-1.28.82-py3-none-any.whl (32 kB)
Downloading mypy_boto3_stepfunctions-1.28.36-py3-none-any.whl (32 kB)
Downloading mypy_boto3_sts-1.28.58-py3-none-any.whl (18 kB)
Downloading mypy_boto3_xray-1.28.64-py3-none-any.whl (33 kB)
Downloading networkx-3.2.1-py3-none-any.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 111.1 MB/s eta 0:00:00
Downloading packaging-23.2-py3-none-any.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 15.0 MB/s eta 0:00:00
Downloading pydantic-2.4.2-py3-none-any.whl (395 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 395.8/395.8 kB 69.4 MB/s eta 0:00:00
Downloading pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 118.2 MB/s eta 0:00:00
Downloading Pygments-2.16.1-py3-none-any.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 107.0 MB/s eta 0:00:00
Downloading referencing-0.30.2-py3-none-any.whl (25 kB)
Downloading rpds_py-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 109.5 MB/s eta 0:00:00
Downloading ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (526 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 526.7/526.7 kB 88.7 MB/s eta 0:00:00
Downloading s3transfer-0.7.0-py3-none-any.whl (79 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.8/79.8 kB 19.1 MB/s eta 0:00:00
Downloading urllib3-2.0.7-py3-none-any.whl (124 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 124.2/124.2 kB 37.3 MB/s eta 0:00:00
Downloading websocket_client-1.6.4-py3-none-any.whl (57 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.3/57.3 kB 21.1 MB/s eta 0:00:00
Downloading werkzeug-3.0.1-py3-none-any.whl (226 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 226.7/226.7 kB 50.8 MB/s eta 0:00:00
Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 kB 19.2 MB/s eta 0:00:00
Downloading botocore_stubs-1.31.84-py3-none-any.whl (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.4/49.4 kB 16.2 MB/s eta 0:00:00
Downloading jsonpatch-1.33-py2.py3-none-any.whl (12 kB)
Downloading pytz-2023.3.post1-py2.py3-none-any.whl (502 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 502.5/502.5 kB 93.8 MB/s eta 0:00:00
Downloading types_s3transfer-0.7.0-py3-none-any.whl (17 kB)
Downloading annotated_types-0.6.0-py3-none-any.whl (12 kB)
Downloading cffi-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (443 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 443.9/443.9 kB 82.4 MB/s eta 0:00:00
Downloading chardet-5.2.0-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.4/199.4 kB 54.3 MB/s eta 0:00:00
Downloading jsonpointer-2.4-py2.py3-none-any.whl (7.8 kB)
Downloading MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Downloading types_python_dateutil-2.8.19.14-py3-none-any.whl (9.4 kB)
Downloading jsonpickle-3.0.2-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.7/40.7 kB 14.3 MB/s eta 0:00:00
Downloading pbr-6.0.0-py2.py3-none-any.whl (107 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.5/107.5 kB 36.3 MB/s eta 0:00:00
Downloading types_awscrt-0.19.10-py3-none-any.whl (17 kB)
Installing collected packages: types-python-dateutil, text-unidecode, pytz, mpmath, chevron, websocket-client, watchdog, urllib3, tzlocal, typing-extensions, types-s3transfer, types-awscrt, tomlkit, sympy, six, ruamel.yaml.clib, rpds-py, regex, PyYAML, python-slugify, pygments, pycparser, pbr, packaging, networkx, mdurl, MarkupSafe, jsonpointer, jsonpickle, jmespath, itsdangerous, idna, click, charset-normalizer, chardet, certifi, blinker, aws-lambda-builders, attrs, annotated-types, Werkzeug, sarif-om, ruamel-yaml, requests, referencing, python-dateutil, pydantic-core, mypy-boto3-xray, mypy-boto3-sts, mypy-boto3-stepfunctions, mypy-boto3-sqs, mypy-boto3-signer, mypy-boto3-secretsmanager, mypy-boto3-schemas, mypy-boto3-s3, mypy-boto3-lambda, mypy-boto3-kinesis, mypy-boto3-iam, mypy-boto3-ecr, mypy-boto3-cloudformation, mypy-boto3-apigateway, markdown-it-py, junit-xml, jsonpatch, jschema-to-python, Jinja2, cffi, botocore-stubs, binaryornot, rich, pydantic, jsonschema-specifications, Flask, docker, dateparser, cryptography, botocore, boto3-stubs, arrow, s3transfer, pyopenssl, jsonschema, cookiecutter, boto3, aws-sam-translator, cfn-lint, aws-sam-cli
Attempting uninstall: PyYAML
Found existing installation: PyYAML 5.4.1
Uninstalling PyYAML-5.4.1:
Successfully uninstalled PyYAML-5.4.1
Successfully installed Flask-3.0.0 Jinja2-3.1.2 MarkupSafe-2.1.3 PyYAML-6.0.1 Werkzeug-3.0.1 annotated-types-0.6.0 arrow-1.3.0 attrs-23.1.0 aws-lambda-builders-1.40.0 aws-sam-cli-1.101.0 aws-sam-translator-1.79.0 binaryornot-0.4.4 blinker-1.7.0 boto3-1.28.84 boto3-stubs-1.28.80 botocore-1.31.84 botocore-stubs-1.31.84 certifi-2023.7.22 cffi-1.16.0 cfn-lint-0.83.1 chardet-5.2.0 charset-normalizer-3.3.2 chevron-0.14.0 click-8.1.7 cookiecutter-2.4.0 cryptography-41.0.5 dateparser-1.1.8 docker-6.1.3 idna-3.4 itsdangerous-2.1.2 jmespath-1.0.1 jschema-to-python-1.2.3 jsonpatch-1.33 jsonpickle-3.0.2 jsonpointer-2.4 jsonschema-4.19.2 jsonschema-specifications-2023.7.1 junit-xml-1.9 markdown-it-py-3.0.0 mdurl-0.1.2 mpmath-1.3.0 mypy-boto3-apigateway-1.28.36 mypy-boto3-cloudformation-1.28.83 mypy-boto3-ecr-1.28.45 mypy-boto3-iam-1.28.79 mypy-boto3-kinesis-1.28.36 mypy-boto3-lambda-1.28.83 mypy-boto3-s3-1.28.55 mypy-boto3-schemas-1.28.36 mypy-boto3-secretsmanager-1.28.67 mypy-boto3-signer-1.28.36 mypy-boto3-sqs-1.28.82 mypy-boto3-stepfunctions-1.28.36 mypy-boto3-sts-1.28.58 mypy-boto3-xray-1.28.64 networkx-3.2.1 packaging-23.2 pbr-6.0.0 pycparser-2.21 pydantic-2.4.2 pydantic-core-2.10.1 pygments-2.16.1 pyopenssl-23.3.0 python-dateutil-2.8.2 python-slugify-8.0.1 pytz-2023.3.post1 referencing-0.30.2 regex-2023.10.3 requests-2.31.0 rich-13.6.0 rpds-py-0.12.0 ruamel-yaml-0.18.5 ruamel.yaml.clib-0.2.8 s3transfer-0.7.0 sarif-om-1.0.4 six-1.16.0 sympy-1.12 text-unidecode-1.3 tomlkit-0.12.2 types-awscrt-0.19.10 types-python-dateutil-2.8.19.14 types-s3transfer-0.7.0 typing-extensions-4.8.0 tzlocal-5.2 urllib3-2.0.7 watchdog-3.0.0 websocket-client-1.6.4
実装はこのあたり。とにかく、pip install
で時間がかかっていそうだ。
速くする方法
実行の度に pip install
されていては時間がかかってしまうので、キャッシュなどできないかと調べたところ、以下のissueを見つけた。
use-installer: true
を設定することで、pip install
の代わりにインストーラを用いてSAM CLIをインストールすることができ、実行時間も大幅に短縮できるらしい。
加えて、workflow内で他に利用していない場合には setup-python
も不要になる。
And you can get rid of setup-python if you only use it for setup-sam.
なお、armプロセッサとLinux以外のPlatformは現状サポートされていないため、x86_64 でのみ可能な点に注意。
You can use it right now in v2 for Linux x86-64:
やってみる
これだけ。
- name: Setup AWS SAM CLI
uses: aws-actions/setup-sam@v2
+ with:
+ use-installer: true
実行結果を見てみると、34s→5sにまで短縮していた。
実行ログはこれだけ。
実行ログ全体
Run aws-actions/setup-sam@v2
with:
use-installer: true
/usr/bin/unzip -o -q /home/runner/work/_temp/927e597d-e38f-4cc9-ab95-cc7e8d23f088
Cached AWS SAM CLI 1.107.0 to /opt/hostedtoolcache/sam/1.107.0/x64
こちらが実装。SAM CLIのインストーラを取ってきて展開しているのが分かる。
おわり
privateリポジトリでSAMアプリケーションを開発している場合には、Actionsの月間実行時間制限を気にしなければならないケースもあるので、workflowの細かい部分の見直しが効いてくる部分もあると思います。
簡単なのに効果が大きいので、ぜひやってみよう。
Discussion