Add latest iamlive version v0.53.0 to test #389
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
name: Test iamlive action | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
check-dist: | |
name: Check dist | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version: '16' | |
- name: Setup yarn | |
run: npm install --location=global yarn | |
- name: Install dependencies | |
run: yarn install | |
- name: Check diff is up to date | |
run: | | |
yarn build | |
git diff --quiet -- dist || { | |
echo "::error::The ./dist is outdated, run 'yarn build' and commit" | |
exit 1 | |
} | |
utilize: | |
name: Use iamlive action | |
runs-on: ubuntu-22.04 | |
needs: [check-dist] | |
permissions: | |
contents: read | |
env: | |
AWS_CSM_ENABLED: 'true' | |
strategy: | |
fail-fast: true | |
matrix: | |
iamliveVersion: [v0.48.0, v0.49.0, v0.53.0] | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version: '16' | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.x' | |
- name: Setup iamlive | |
id: setup-iamlive | |
uses: ./ | |
with: | |
iamlive-version: ${{ matrix.iamliveVersion }} | |
auto-capture: true | |
output-file: ./test-policy.json | |
- name: Check output and installPath | |
run: | | |
[ "${IAMLIVE_VERSION}" == v0.48.0 ] || { echo >&2 "::error::Expected v0.48.0 to be installed."; } | |
hash iamlive 2>/dev/null || { echo >&2 "iamlive can not be found in the PATH."; exit 1; } | |
echo "::notice::Installed iamlive ${IAMLIVE_VERSION} at $(which iamlive)" | |
env: | |
IAMLIVE_VERSION: ${{ steps.setup-iamlive.outputs.iamlive-version }} | |
- name: Setup LocalStack | |
run: | | |
pip install --upgrade pip | |
pip install localstack awscli-local[ver1] | |
docker pull localstack/localstack | |
localstack start -d | |
echo "Waiting for LocalStack startup..." | |
localstack wait -t 30 | |
echo "Startup complete" | |
- name: Call a bunch of aws apis | |
run: | | |
awslocal s3 mb s3://test | |
awslocal s3 ls | |
- name: Is iamlive still running | |
run: ps aux | grep iamlive | |
assert: | |
name: Assert policy | |
runs-on: ubuntu-22.04 | |
needs: [utilize] | |
steps: | |
- name: download-policy | |
uses: actions/[email protected] | |
with: | |
name: test-policy.json | |
- name: check-policy | |
run: | | |
echo "assert policy has file" | |
cat ./test-policy.json | |
cat test-policy.json | grep 's3:CreateBucket' | |
cat test-policy.json | grep 's3:ListAllMyBuckets' |