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

Felles workflow for frontend og backend (Verify pull request) #6556

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
47 changes: 45 additions & 2 deletions .github/workflows/.test.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
name: .build-backend.yaml
name: .test.yaml

on:
workflow_call:

jobs:
test:
determine-project-type:
name: Determine project type
runs-on: ubuntu-latest-8-cores
outputs:
type: ${{ steps.determine.outputs.type }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- id: determine
working-directory: apps/${{ github.workflow }}
run: |
if [ -f "package.json" ]; then
echo "type=frontend" >> "$GITHUB_OUTPUT"
else
echo "type=backend" >> "$GITHUB_OUTPUT"
fi

verify-backend:
name: Verify pull request
if: needs.determine-project-type.outputs.type == 'backend'
needs: [determine-project-type]
runs-on: ubuntu-latest-8-cores
timeout-minutes: 10
steps:
Expand All @@ -22,3 +41,27 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :apps:${{ github.workflow }}:test --stacktrace --configuration-cache

verify-frontend:
name: Verify pull request
if: needs.determine-project-type.outputs.type == 'frontend'
needs: [determine-project-type]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: apps/${{ github.workflow }}/client/yarn.lock
- name: Install client
working-directory: apps/${{ github.workflow }}
run: yarn --cwd client install --frozen-lockfile && yarn --cwd client build
- name: Install server
working-directory: apps/${{ github.workflow }}
run: yarn --cwd server install --frozen-lockfile && yarn --cwd server build
- name: Run tests
working-directory: apps/${{ github.workflow }}/client
run: CI=true yarn test
22 changes: 2 additions & 20 deletions .github/workflows/app-etterlatte-saksbehandling-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,8 @@ permissions:
jobs:
test:
if: github.event_name == 'pull_request'
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
cache-dependency-path: apps/${{ env.APP_NAME }}/client/yarn.lock
- name: Install client
working-directory: apps/${{ env.APP_NAME }}
run: yarn --cwd client install --frozen-lockfile && yarn --cwd client build
- name: Install server
working-directory: apps/${{ env.APP_NAME }}
run: yarn --cwd server install --frozen-lockfile && yarn --cwd server build
- name: Run tests
working-directory: apps/${{ env.APP_NAME }}/client
run: CI=true yarn test
uses: ./.github/workflows/.test.yaml
secrets: inherit

build:
if: github.event_name != 'pull_request'
Expand Down