From 569d4e9a33dfd373fdaa7026f5dbd7cf82462718 Mon Sep 17 00:00:00 2001 From: Thada Wangthammang Date: Fri, 17 May 2024 08:25:08 +0700 Subject: [PATCH] fix(github-actions): download artifact path --- .github/workflows/e2e.yml | 19 +++++++++++++------ infra/e2e-local/e2e-local.test.ts | 6 +++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3a7654f..b771e27 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -90,15 +90,13 @@ jobs: - build - get-matrix timeout-minutes: 10 + env: + artifact_download_path: ./build-functions strategy: matrix: include: ${{fromJson(needs.get-matrix.outputs.matrix)}} steps: - - name: Download Artifact - uses: actions/download-artifact@v4 - with: - name: ${{ matrix.resource_identifier_key }} - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 @@ -120,11 +118,20 @@ jobs: - name: Azure Functions Version run: func --version + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.resource_identifier_key }} + path: ${{ github.workspace }}/${{ env.artifact_download_path}} + + - name: Display structure of downloaded files + run: ls -R ${{ github.workspace }}/${{ env.artifact_download_path}} + - name: Build the project run: pnpm exec nx run @infra/e2e-local:test env: - RUNTIME: ${{ matrix.runtime }} - + CURRENT_WORKING_DIR: ${{ github.workspace }}/${{ env.artifact_download_path}} + deploy: runs-on: ubuntu-latest needs: diff --git a/infra/e2e-local/e2e-local.test.ts b/infra/e2e-local/e2e-local.test.ts index edced04..62f2448 100644 --- a/infra/e2e-local/e2e-local.test.ts +++ b/infra/e2e-local/e2e-local.test.ts @@ -6,6 +6,7 @@ const TIME_LIMIT = parseInt(process.env.TIME_LIMIT ?? '60000'); // Default 60 se const DEBUG = (process.env.LOCAL_TEST_DEBUG ?? '').toLowerCase() === 'true'; const LOCAL_URL = process.env.LOCAL_TEST_URL ?? 'http://127.0.0.1:7071'; const HEALTH_PATH = process.env.LOCAL_TEST_HEALTH_PATH ?? '/api/SimpleHttpTrigger'; +const CURRENT_WORKING_DIR = process.env.CURRENT_WORKING_DIR ?? path.resolve('../../'); function waitForServer(url: string) { return new Promise((resolve, reject) => { @@ -45,12 +46,11 @@ describe('e2e-local', () => { let serverLogs = ''; beforeAll(async () => { - const workingDir = path.resolve('../../') - console.log(`Starting server process on ${workingDir}`); + console.log(`Starting server process on ${CURRENT_WORKING_DIR}`); // Place Azure Functions into the current directory const command = DEBUG ? ['sleep', '60'] : ['func', 'start', '--verbose']; const serverProcess = Bun.spawn(command, { - cwd: workingDir, + cwd: CURRENT_WORKING_DIR, stdout: 'inherit', onExit(proc, exitCode, signalCode, error) { if (exitCode !== 0) {