Skip to content

Build

Build #589

name: Build
on:
pull_request:
branches: [master, "feat*"]
merge_group:
types: [checks_requested]
branches: [master, "feat*"]
env:
PYTHON_VERSION_INSTALL: '3.11'
SAM_CLI_DEV: 1
PIP_CARGO_LAMBDA_VERSION: '1.1.0'
jobs:
run-workflow:
name: Build & Test & Invoke Templates
if: github.repository_owner == 'aws' && always()
runs-on: ubuntu-latest
needs:
- build-test-python
- build-test-java
- build-test-nodejs
- build-test-ruby
- build-test-rust
- build-test-golang
- build-test-dotnet
- test-manifest
- refactor-validation
steps:
- name: report-failure
if: |
needs.build-test-python.result != 'success' ||
needs.build-test-java.result != 'success' ||
needs.build-test-nodejs.result != 'success' ||
needs.build-test-ruby.result != 'success' ||
needs.build-test-rust.result != 'success' ||
needs.build-test-golang.result != 'success' ||
needs.build-test-dotnet.result != 'success' ||
needs.test-manifest.result != 'success' ||
needs.refactor-validation.result != 'success'
run: exit 1
- name: report-success
run: exit 0
################
# Test Manifest
test-manifest:
name: Test Manifest File
if: github.repository_owner == 'aws'
env:
PYTHON_VERSION_INSTALL: '3.12'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: actions/setup-python@v4
name: Setup Python 3.12
with:
python-version: '3.12'
- name: Run build tests for tests/unit/
run: |
pip install -r requirements.txt
pytest -n auto -vvv tests/unit/
################
# Python
build-test-python:
name: ${{ matrix.type }} / Python ${{ matrix.version }}
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
include:
- version: '3.8'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_8.py'
- version: '3.8'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_8.py'
- version: '3.9'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_9.py'
- version: '3.9'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_9.py'
- version: '3.10'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_10.py'
- version: '3.10'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_10.py'
- version: '3.11'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_11.py'
- version: '3.11'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_11.py'
- version: '3.12'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_12.py'
- version: '3.12'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_12.py'
- version: '3.13'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_python3_13.py'
- version: '3.13'
type: 'Invoke'
file: 'tests/integration/build_invoke/python/test_python_3_13.py'
env:
PYTHON_VERSION_INSTALL: ${{ matrix.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: actions/setup-python@v4
name: Setup Python ${{ matrix.version }}
with:
python-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
pytest -n auto -vvv ${{ matrix.file }}
################
# Java
build-test-java:
name: ${{ matrix.type }} / Java ${{ matrix.version }}
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
include:
- version: '8'
type: 'Test (AL2)'
file: 'tests/integration/unit_test/test_unit_test_java8_al2.py'
- version: '8'
type: 'Invoke (AL2)'
file: 'tests/integration/build_invoke/java/test_java_8_al2.py'
- version: '11'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_java11.py'
- version: '11'
type: 'Invoke'
file: 'tests/integration/build_invoke/java/test_java_11.py'
- version: '11'
type: 'Invoke (AL2)'
file: 'tests/integration/build_invoke/java/test_java_11_al2.py'
- version: '17'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_java17.py'
- version: '17'
type: 'Invoke'
file: 'tests/integration/build_invoke/java/test_java_17.py'
- version: '21'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_java21.py'
- version: '21'
type: 'Invoke'
file: 'tests/integration/build_invoke/java/test_java_21.py'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: actions/setup-java@v3
name: Setup Java ${{ matrix.version }}
with:
distribution: 'corretto'
java-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
gradle --version
mvn --version
pytest -n auto -vvv ${{ matrix.file }}
################
# NodeJS
build-test-nodejs:
name: ${{ matrix.type }} / NodeJS ${{ matrix.version }}
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
include:
- version: '18'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_nodejs18_x.py'
- version: '18'
type: 'Invoke'
file: 'tests/integration/build_invoke/node/test_node_18.py'
- version: '20'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_nodejs20_x.py'
- version: '20'
type: 'Invoke'
file: 'tests/integration/build_invoke/node/test_node_20.py'
- version: '22'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_nodejs22_x.py'
- version: '22'
type: 'Invoke'
file: 'tests/integration/build_invoke/node/test_node_22.py'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: actions/setup-node@v3
name: Setup NodeJS ${{ matrix.version }}
with:
node-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
echo "node: $(node --version)"
echo "npm: $(npm --version)"
pytest -n auto -vvv ${{ matrix.file }}
################
# Ruby
build-test-ruby:
name: ${{ matrix.type }} / Ruby ${{ matrix.version }}
if: github.repository_owner == 'aws'
strategy:
fail-fast: false
matrix:
include:
- version: '3.2'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_ruby3_2.py'
- version: '3.2'
type: 'Invoke'
file: 'tests/integration/build_invoke/ruby/test_ruby_3_2.py'
- version: '3.3'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_ruby3_3.py'
- version: '3.3'
type: 'Invoke'
file: 'tests/integration/build_invoke/ruby/test_ruby_3_3.py'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: ruby/setup-ruby@v1
name: Setup Ruby ${{ matrix.version }}
with:
ruby-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
ruby --version
pytest -n auto -vvv ${{ matrix.file }}
################
# Rust
build-test-rust:
name: ${{ matrix.type }} / Rust
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_rust.py'
- type: 'Invoke'
file: 'tests/integration/build_invoke/test_build_invoke_rust.py'
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- name: Setup Rust
run: |
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL https://sh.rustup.rs | sh -s -- --default-toolchain none -y
source $HOME/.cargo/env
rustup toolchain install stable --profile minimal --no-self-update
rustup default stable
rustup target add x86_64-unknown-linux-gnu --toolchain stable
pip install cargo-lambda==$PIP_CARGO_LAMBDA_VERSION
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
rustc -V
cargo -V
cargo lambda -V
pytest -n auto -vvv ${{ matrix.file }}
################
# golang
build-test-golang:
name: ${{ matrix.type }} / golang ${{ matrix.version }}
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- version: '1.x'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_go1_x.py'
- version: '1.x'
type: 'Invoke'
file: 'tests/integration/build_invoke/test_build_invoke_go1_x.py'
env:
CGO_ENABLED: 0
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: actions/setup-go@v3
name: Setup golang ${{ matrix.version }}
with:
go-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
go version
pytest -n auto -vvv ${{ matrix.file }}
################
# dotnet
build-test-dotnet:
name: ${{ matrix.type }} / dotnet ${{ matrix.version }}
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- version: '6'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_dotnet6.py'
- version: '6'
type: 'Invoke'
file: 'tests/integration/build_invoke/dotnet/test_build_invoke_dotnet6.py'
- version: '8'
type: 'Test'
file: 'tests/integration/unit_test/test_unit_test_dotnet8.py'
- version: '8'
type: 'Invoke'
file: 'tests/integration/build_invoke/dotnet/test_build_invoke_dotnet8.py'
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- uses: actions/setup-dotnet@v4
name: Setup dotnet ${{ matrix.version }}
with:
dotnet-version: ${{ matrix.version }}
- name: Run build tests for ${{ matrix.file }}
run: |
pip install -r requirements.txt
samdev --info
dotnet --info
dotnet --version
pytest -vvv ${{ matrix.file }}
# refactor
refactor-validation:
name: refactor validation
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout PR
- uses: ./.github/actions/aws-sam-cli-develop
name: Install develop version of AWS SAM CLI
- name: Run refactor tests
run: |
pip install -r requirements.txt
samdev --info
dotnet --info
dotnet --version
pytest -vvv --log-cli-level INFO tests/refactor