Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(repo): maintainers can run sdk spec tests on forks #4322

Merged
merged 22 commits into from
Oct 1, 2023
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 41 additions & 5 deletions .github/workflows/tf-aws-test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
name: SDK Spec AWS Tests
run-name: SDK Spec AWS Tests (${{ inputs.repo || github.repository }}/${{inputs.ref || github.ref}})
on:
workflow_call: {}
workflow_dispatch: {}
workflow_dispatch:
inputs:
repo:
type: string
default: winglang/wing
ref:
type: string
default: main
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved

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'}}
LOCAL_BUILD: ${{ github.workflow == 'build' && github.event_name == 'workflow_dispatch'}}
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved
# 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}}
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved
ALLOWED_USERS: ("tsuf239" "MarkMcCulloh" "eladb" "revitalbarletz" "ShaiBer" "Chriscbr" "hasanaburayyan" "staycoolcall911" "ekeren")
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved
PNPM_VERSION: "8.6.3"

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: cancel run if not allowed
tsuf239 marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ env.MANUAL == 'true' && !contains(env.ALLOWED_USERS, github.actor)}}
run: |
echo "User ${{github.actor}} is not allowed to dispatch this action."
exit 1
- name: Checkout Repository
uses: actions/checkout@v3
with:
repository: ${{env.REPO}}
ref: ${{env.REF}}

- name: Get list of directories and save them to the output
id: setdirs
shell: bash
Expand All @@ -37,6 +60,15 @@ 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
Expand All @@ -62,7 +94,7 @@ jobs:

#################### install a remote wing version ########################
- name: Install winglang globally
if: ${{ env.LOCAL_BUILD == 'false' }}
if: ${{ env.LOCAL_BUILD == 'false' && env.MANUAL == 'false'}}
uses: nick-fields/retry@v2
with:
max_attempts: 3
Expand Down Expand Up @@ -91,11 +123,15 @@ jobs:
retry_on: error
timeout_minutes: 30
command: |
if ${{ env.LOCAL_BUILD == 'false' }}
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
./localwing/node_modules/.bin/wing test -t tf-aws ${{ matrix.test.directory }}/*.w
fi

- name: Output Terraform log
Expand Down
Loading