feat(github-actions): support isDeployable flag #15
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: 'E2E Tests' | |
on: | |
push: | |
branches: [v3.x-bundle] | |
paths-ignore: | |
- '**/*.md' | |
# pull_request: | |
# branches: [ main ] | |
# paths-ignore: | |
# - '**/*.md' | |
env: | |
pnpm_version: 8 | |
node_version: 20 | |
debug_identifier: nammatham:* | |
RESOURCE_IDENTIFIER_NODE18_LINUX_X64: ${{ secrets.RESOURCE_IDENTIFIER_NODE18_LINUX_X64 }} | |
jobs: | |
get-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.deploy-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Use Node.js ${{ env.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{env.node_version }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: ${{ env.pnpm_version }} | |
- run: pnpm install | |
- name: Export the matrix for testing | |
id: deploy-matrix | |
run: pnpm exec nx run @infra/azure-functions:github-actions | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: get-matrix | |
strategy: | |
matrix: | |
include: ${{fromJson(needs.get-matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
- name: Use Node.js ${{ matrix.version }} | |
if: matrix.runtime == 'node' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.version }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: ${{ env.pnpm_version }} | |
- run: pnpm install | |
- run: pnpm build | |
- name: pnpm install again for ensure the cli is available | |
run: pnpm install | |
- name: Build the project | |
run: pnpm exec nx run @examples/with-${{ matrix.runtime }}:build | |
env: | |
DEBUG: ${{ env.debug_identifier }} | |
- name: Azure Login | |
uses: azure/login@v2 | |
if: matrix.is_deployable == true | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS_E2E_TESTS }} | |
- name: Deploy to Azure Functions | |
uses: Azure/functions-action@v1 | |
if: matrix.is_deployable == true | |
with: | |
app-name: nmt-e2e-${{ matrix.target }}-${{ secrets[matrix.resource_identifier_key] }} | |
package: examples/with-${{ matrix.runtime }}/.nmt/dist | |
- name: Wait for the deployment to finish | |
if: matrix.is_deployable == true | |
run: sleep 15 | |
- name: Run E2E tests | |
if: matrix.is_deployable == true | |
run: pnpm exec nx run @infra/azure-functions:test | |
env: | |
AZURE_FUNCTIONS_URL: https://nmt-e2e-${{ matrix.target }}-${{ secrets[matrix.resource_identifier_key] }}.azurewebsites.net | |
AZURE_FUNCTIONS_API_KEY: ${{ secrets.AZURE_FUNCTIONS_HOST_KEY }} |