diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d9a0fd..df4ab7e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,44 +6,94 @@ on: # rebuild any PRs and main branch changes - main - 'releases/*' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + jobs: build: # make sure build/ci work properly runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: | - npm install - - run: | - npm run all - test: # make sure the action works on a clean machine without building + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 8 + + - name: Install dependencies + run: pnpm install + + - name: Rebuild the dist/ directories + run: | + pnpm run -r build + pnpm run -r package + + test-plain: + runs-on: ubuntu-latest + env: + AWS_DEFAULT_REGION: 'us-east-1' + TF_BACKEND_BUCKET: ${{ secrets.TF_BACKEND_BUCKET }} + TF_BACKEND_BUCKET_REGION: 'us-east-1' + steps: + - uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + role-session-name: gh-action-winglang + aws-region: ${{ env.AWS_DEFAULT_REGION }} + - uses: ./actions/deploy + name: "Plain Wing app" + with: + entry: 'main.w' + working-directory: './examples/plain' + target: 'tf-aws' + backend: 's3' + test-cdktf: + runs-on: ubuntu-latest + env: + AWS_DEFAULT_REGION: 'us-east-1' + TF_BACKEND_BUCKET: ${{ secrets.TF_BACKEND_BUCKET }} + TF_BACKEND_BUCKET_REGION: 'us-east-1' + steps: + - uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + role-session-name: gh-action-winglang + aws-region: ${{ env.AWS_DEFAULT_REGION }} + - uses: ./actions/deploy + name: "Plain Wing app" + with: + entry: 'main.w' + working-directory: './examples/with-cdktf' + target: 'tf-aws' + backend: 's3' + + test-dependencies: runs-on: ubuntu-latest - # env: # set the env vars for the action - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_DEFAULT_REGION: 'us-east-1' - # TF_BACKEND_BUCKET: foo - # TF_BACKEND_BUCKET_REGION: 'us-east-1' + env: + AWS_DEFAULT_REGION: 'us-east-1' + TF_BACKEND_BUCKET: ${{ secrets.TF_BACKEND_BUCKET }} + TF_BACKEND_BUCKET_REGION: 'us-east-1' steps: - uses: actions/checkout@v3 - # local testing only for now - # - uses: ./ - # name: "Plain Wing app" - # with: - # entry: './examples/plain/main.w' - # target: 'tf-aws' - # backend: 's3' - # - uses: ./ - # name: "Wing app with npm dependencies" - # with: - # entry: 'main.w' - # working-directory: 'examples/with-dependencies' - # target: 'tf-aws' - # backend: 's3' - # - uses: ./actions/deploy - # name: "Wing app with cdktf dependency" - # with: - # version: '0.21.4' - # entry: 'main.w' - # working-directory: 'examples/with-cdktf' - # target: 'tf-aws' - # backend: 's3' \ No newline at end of file + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + role-session-name: gh-action-winglang + aws-region: ${{ env.AWS_DEFAULT_REGION }} + - uses: ./actions/deploy + name: "Plain Wing app" + with: + entry: 'main.w' + working-directory: './examples/with-dependencies' + target: 'tf-aws' + backend: 's3' \ No newline at end of file