Skip to content

Commit

Permalink
download frontend files everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed May 7, 2024
1 parent 87f411f commit 1fe84a0
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 46 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Frontend

on:
workflow_call:

jobs:
nextjs-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@v4
- name: Use npm
uses: actions/setup-node@v4

- name: Build frontend
run: |
npm install
npm run build
- name: Upload frontend files
uses: actions/upload-artifact@v4
with:
name: frontend-static-files
path: ui/out
22 changes: 0 additions & 22 deletions .github/workflows/build-gocert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,10 @@ on:
workflow_call:

jobs:
nextjs-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@v4
- name: Use npm
uses: actions/setup-node@v4

- name: Build frontend
run: |
npm install
npm run build
- name: Upload frontend files
uses: actions/upload-artifact@v4
with:
name: frontend-static-files
path: ui/out

go-build:
runs-on: ubuntu-latest
needs: [nextjs-build]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/go-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Download frontend files
uses: actions/download-artifact@v4
with:
name: frontend-static-files
path: ui/out
- name: golangci-lint
uses: golangci/golangci-lint-action@v5
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/go-vet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Download frontend files
uses: actions/download-artifact@v4
with:
name: frontend-static-files
path: ui/out
- name: Go vet
run: go vet ./...
17 changes: 11 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ on:
- main

jobs:
build-gocert:
uses: ./.github/workflows/build-gocert.yaml
unit-test-frontend:
uses: ./.github/workflows/test-frontend.yaml
build-nextjs:
uses: ./.github/workflows/build-frontend.yaml
unit-test-gocert:
needs: [build-gocert]
needs: [build-nextjs]
uses: ./.github/workflows/test-gocert.yaml
go-vet:
needs: [build-gocert]
needs: [build-nextjs]
uses: ./.github/workflows/go-vet.yaml
go-lint:
needs: [build-gocert]
needs: [build-nextjs]
uses: ./.github/workflows/go-lint.yaml
build-gocert:
needs: [build-nextjs]
uses: ./.github/workflows/build-gocert.yaml
rock-build:
needs: [build-gocert, unit-test-gocert, go-vet, go-lint]
needs: [build-nextjs, unit-test-gocert, go-vet, go-lint]
uses: ./.github/workflows/build-rock.yaml
rock-scan:
if: github.ref_name == 'main'
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test-frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Unit Test Frontend

on:
workflow_call:

jobs:
nextjs-unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@v3
- name: Use npm
uses: actions/setup-node@v4

- name: Build frontend
run: |
npm install
npm run test
22 changes: 6 additions & 16 deletions .github/workflows/test-gocert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,19 @@ on:
workflow_call:

jobs:
nextjs-unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
steps:
- uses: actions/checkout@v3
- name: Use npm
uses: actions/setup-node@v4

- name: Build frontend
run: |
npm install
npm run test
go-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"


- name: Download frontend files
uses: actions/download-artifact@v4
with:
name: frontend-static-files
path: ui/out
- name: Unit tests
run: go test -cover ./...

0 comments on commit 1fe84a0

Please sign in to comment.