Add new Datadog::Integrations::AWSAccount
resource
#335
Workflow file for this run
This file contains hidden or 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
name: Run Contract Tests | |
permissions: | |
contents: read | |
# env: | |
# GIT_AUTHOR_EMAIL: "[email protected]" | |
# GIT_AUTHOR_NAME: "ci.datadog-cloudformation-resources" | |
on: | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: contract-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
find_modified_resources: | |
# needs: pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed_files | |
run: | | |
CHANGED_FILES=$(git diff --name-only origin/$GITHUB_BASE_REF...$GITHUB_SHA | tr '\n' ' ') | |
echo "all_changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT | |
outputs: | |
changed_files: ${{ steps.changed_files.outputs.all_changed_files }} | |
test: | |
needs: find_modified_resources | |
strategy: | |
fail-fast: false | |
matrix: | |
resource: | |
- datadog-dashboards-dashboard-handler | |
- datadog-monitors-monitor-handler | |
- datadog-monitors-downtime-handler | |
- datadog-monitors-downtimeschedule-handler | |
- datadog-integrations-aws-handler | |
- datadog-integrations-awsaccount-handler | |
- datadog-slos-slo-handler | |
# - datadog-iam-user-handler | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Install Python | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 | |
with: | |
python-version: 3.9 | |
- uses: aws-actions/setup-sam@819220f63fb333a9a394dd0a5cab2d8303fd17e2 | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
- name: Checkout code | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Install Deps | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: pip install --disable-pip-version-check -e ./datadog-cloudformation-common-python[build] | |
- name: Install pre-commit | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: python -m pip install pre-commit | |
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Check generated files are up-to-date | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: | | |
cd ${{ matrix.resource }} | |
cfn generate | |
set +e | |
pre-commit run --all-files | |
git diff --exit-code | |
if [ $? -ne 0 ]; then | |
echo "'cfn generate and pre-commit run --all-files' generated changes. Run it locally and commit the changes." | |
exit 1 | |
fi | |
set -e | |
- name: Build Package | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: | | |
cd ${{ matrix.resource }} | |
cfn submit --dry-run --no-role | |
- name: Create Type Configuration | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: | | |
mkdir ~/.cfn-cli | |
echo "{\"DatadogCredentials\":{\"ApiKey\":\"${DD_TEST_CLIENT_API_KEY}\",\"ApplicationKey\":\"${DD_TEST_CLIENT_APP_KEY}\"}}" > ~/.cfn-cli/typeConfiguration.json | |
env: | |
DD_TEST_CLIENT_API_KEY: ${{ secrets.DD_TEST_CLIENT_API_KEY }} | |
DD_TEST_CLIENT_APP_KEY: ${{ secrets.DD_TEST_CLIENT_APP_KEY }} | |
- name: Run Tests | |
if: contains(needs.find_modified_resources.outputs.changed_files, matrix.resource) | |
run: | | |
cd ${{ matrix.resource }} | |
sam local start-lambda & | |
cfn test --role-arn arn:aws:iam::088054601418:role/cf-contract-tests-ci | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |