Skip to content

Commit

Permalink
fix(github-actions): fix permission denied from build artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
mildronize committed May 17, 2024
1 parent 1fe1610 commit f936eeb
Showing 1 changed file with 77 additions and 66 deletions.
143 changes: 77 additions & 66 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ jobs:
retention-days: 1

e2e-local:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
needs:
- build
- get-matrix
timeout-minutes: 10
env:
artifact_download_path: ./build-functions
artifact_download_path: build-functions
strategy:
matrix:
include: ${{fromJson(needs.get-matrix.outputs.matrix)}}
Expand Down Expand Up @@ -124,71 +124,82 @@ jobs:
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
- name: Set execute permissions (Linux/macOS)
if: runner.os != 'Windows'
run: |
chmod +x ${{ github.workspace }}/${{ env.artifact_download_path}}/main
ls -la ${{ github.workspace }}/${{ env.artifact_download_path}}
# Set-ExecutionPolicy Bypass -Scope Process -Force
- name: Set execute permissions (Windows)
if: runner.os == 'Windows'
run: |
icacls.exe "${{ github.workspace }}/${{ env.artifact_download_path}}/main.exe" /grant Everyone:F
icacls.exe "${{ github.workspace }}/${{ env.artifact_download_path}}/main.exe" /T /C /Q
Get-ChildItem -Path "${{ github.workspace }}/${{ env.artifact_download_path}}" -Force | Format-Table -Property Mode,LastWriteTime,Length,Name
- name: Run E2E tests locally
run: pnpm exec nx run @infra/e2e-local:test
env:
CURRENT_WORKING_DIR: ${{ github.workspace }}/${{ env.artifact_download_path}}

deploy:
runs-on: ubuntu-latest
needs:
- build
- get-matrix
timeout-minutes: 10
strategy:
matrix:
include: ${{fromJson(needs.get-matrix.outputs.deployable_matrix)}}

steps:
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS_E2E_TESTS }}

- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.resource_identifier_key }}

- name: Deploy to Azure Functions
uses: Azure/functions-action@v1
with:
app-name: nmt-e2e-${{ matrix.target }}-${{ secrets[matrix.resource_identifier_key] }}
package: .

e2e-azure:
if: always()
runs-on: ubuntu-latest
needs:
- build
- deploy
- get-matrix
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.get-matrix.outputs.deployable_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@v3
name: Install pnpm
with:
version: ${{ env.pnpm_version }}
- run: pnpm install

- name: Run E2E tests
run: pnpm exec nx run @infra/azure-functions:test:e2e-remote
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 }}
# deploy:
# runs-on: ubuntu-latest
# needs:
# - build
# - get-matrix
# timeout-minutes: 10
# strategy:
# matrix:
# include: ${{fromJson(needs.get-matrix.outputs.deployable_matrix)}}

# steps:
# - name: Azure Login
# uses: azure/login@v2
# with:
# creds: ${{ secrets.AZURE_CREDENTIALS_E2E_TESTS }}

# - name: Download Artifact
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.resource_identifier_key }}

# - name: Deploy to Azure Functions
# uses: Azure/functions-action@v1
# with:
# app-name: nmt-e2e-${{ matrix.target }}-${{ secrets[matrix.resource_identifier_key] }}
# package: .

# e2e-azure:
# if: always()
# runs-on: ubuntu-latest
# needs:
# - build
# - deploy
# - get-matrix
# timeout-minutes: 10
# strategy:
# fail-fast: false
# matrix:
# include: ${{fromJson(needs.get-matrix.outputs.deployable_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@v3
# name: Install pnpm
# with:
# version: ${{ env.pnpm_version }}
# - run: pnpm install

# - name: Run E2E tests
# run: pnpm exec nx run @infra/azure-functions:test:e2e-remote
# 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 }}

0 comments on commit f936eeb

Please sign in to comment.