-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into revitalb-range-tests
- Loading branch information
Showing
232 changed files
with
7,785 additions
and
1,905 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,63 @@ | ||
name: SDK Spec AWS Tests | ||
run-name: SDK Spec AWS Tests (${{ inputs.repo || github.repository }}/${{inputs.ref || github.ref}}) | ||
on: | ||
release: | ||
types: | ||
- published | ||
workflow_dispatch: {} | ||
workflow_call: {} | ||
workflow_dispatch: | ||
inputs: | ||
repo: | ||
type: string | ||
default: winglang/wing | ||
description: "Full repo name (owner/name)" | ||
ref: | ||
type: string | ||
default: main | ||
description: "Ref to checkout. Must be present in the repo input." | ||
|
||
env: | ||
AWS_REGION: "us-east-1" | ||
NODE_VERSION: "18.16.0" | ||
# this variable indicates wheater to use wing cli from a local version (using the current repo code) | ||
# or use the latest remote npm version | ||
LOCAL_BUILD: ${{ github.workflow == 'build' }} | ||
# indicates if the action triggered from a workflow_dispatch | ||
MANUAL: ${{ github.event_name == 'workflow_dispatch' }} | ||
REPO: ${{ inputs.repo || github.repository }} | ||
REF: ${{ inputs.ref || github.ref }} | ||
PNPM_VERSION: "8.6.3" | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: test if is maintainer | ||
uses: tspascoal/get-user-teams-membership@v2 | ||
id: testUserGroup | ||
if: ${{ env.MANUAL == 'true' }} | ||
with: | ||
username: ${{ github.actor }} | ||
team: "maintainers" | ||
GITHUB_TOKEN: ${{ secrets.GH_GROUPS_READ_TOKEN }} | ||
- name: cancel run if not allowed | ||
if: ${{ env.MANUAL == 'true' && steps.testUserGroup.outputs.isTeamMember == 'false' }} | ||
run: | | ||
echo "User ${{github.actor}} is not allowed to dispatch this action." | ||
exit 1 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Get list of directories | ||
with: | ||
repository: ${{env.REPO}} | ||
ref: ${{env.REF}} | ||
|
||
- name: Get list of directories and save them to the output | ||
id: setdirs | ||
shell: bash | ||
run: | | ||
dirs=$(ls -d examples/tests/sdk_tests/*/ | sed 's/\/$//' | grep -v "external" | jq -R -s -c 'split("\n")[:-1]') | ||
processed_dirs=$(echo "{ \"directory\": $dirs }" | jq -c '[ .directory[] | {directory: ., name: (split("/") | last)}]') | ||
wrapped_dirs=$(echo "{ \"test\": $processed_dirs }" | jq -c .) | ||
echo "DIRS=$wrapped_dirs" >> $GITHUB_ENV | ||
- name: Pass environment variable to output | ||
id: passenv | ||
run: | | ||
echo "::set-output name=dirs::$DIRS" | ||
echo "dirs=$wrapped_dirs" >> $GITHUB_OUTPUT | ||
outputs: | ||
tests: ${{ steps.passenv.outputs.dirs }} | ||
tests: ${{ steps.setdirs.outputs.dirs }} | ||
|
||
test-tf-aws: | ||
needs: setup | ||
|
@@ -39,21 +69,53 @@ jobs: | |
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{env.REPO}} | ||
ref: ${{env.REF}} | ||
|
||
- name: Setup pnpm | ||
if: ${{ env.MANUAL == 'true' }} | ||
uses: pnpm/[email protected] | ||
with: | ||
version: ${{ env.PNPM_VERSION }} | ||
|
||
- name: Setup Node.js v18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
##################### install a local wing version ######################### | ||
- name: Download Dist Artifacts | ||
if: ${{ env.LOCAL_BUILD == 'true' }} | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Install Wing from Dist | ||
if: ${{ env.LOCAL_BUILD == 'true' }} | ||
run: | | ||
mkdir localwing | ||
cd localwing | ||
npm init --yes | ||
npm install ../dist/*-[0-9]*.[0-9]*.[0-9]*.tgz | ||
./node_modules/.bin/wing --version | ||
#################### install a remote wing version ######################## | ||
- name: Install winglang globally | ||
if: ${{ env.LOCAL_BUILD == 'false' && env.MANUAL == 'false'}} | ||
uses: nick-fields/retry@v2 | ||
with: | ||
max_attempts: 3 | ||
retry_on: error | ||
timeout_minutes: 5 | ||
command: npm install -g winglang | ||
######################################################################## | ||
- name: Installing external js modules | ||
run: | | ||
cd examples/tests/sdk_tests | ||
npm install | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
|
@@ -68,8 +130,19 @@ jobs: | |
with: | ||
max_attempts: 3 | ||
retry_on: error | ||
timeout_minutes: 20 | ||
command: wing test -t tf-aws ${{ matrix.test.directory }}/*.w | ||
timeout_minutes: 30 | ||
command: | | ||
if ${{ env.MANUAL == 'true' }} | ||
then | ||
pnpm install | ||
pnpm wing test -t tf-aws ${{ matrix.test.directory }}/*.w | ||
elif ${{ env.LOCAL_BUILD == 'false'}} | ||
then | ||
wing test -t tf-aws ${{ matrix.test.directory }}/*.w | ||
else | ||
./localwing/node_modules/.bin/wing test -t tf-aws ${{ matrix.test.directory }}/*.w | ||
fi | ||
- name: Output Terraform log | ||
if: failure() | ||
run: cat ${{ runner.workspace }}/terraform.log |
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
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
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
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
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
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
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
Oops, something went wrong.