From 5b7640b9efd826384ed6e1cad85b96f5b317ebda Mon Sep 17 00:00:00 2001 From: Cannon Lock Date: Fri, 22 Mar 2024 14:25:44 -0500 Subject: [PATCH] Unify Build Process - Add `make web-build` to goreleaser `before` - Add NPM and NODE to dockerfile so website can be built in goreleaser process --- .github/workflows/go-generate-check.yml | 27 +++++++++++++++++++++ .github/workflows/release.yml | 3 --- .goreleaser.yml | 2 +- .pre-commit-config.yaml | 1 + docs/parameters.json | 2 +- docs/parameters.yaml | 2 +- images/Dockerfile | 13 ++-------- web_ui/frontend/public/data/parameters.json | 2 +- 8 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/go-generate-check.yml diff --git a/.github/workflows/go-generate-check.yml b/.github/workflows/go-generate-check.yml new file mode 100644 index 000000000..b68278266 --- /dev/null +++ b/.github/workflows/go-generate-check.yml @@ -0,0 +1,27 @@ +name: Check Go Generate Has been Run +on: + pull_request: +jobs: + validate-generated-files: + name: Check Go Generate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" + + - name: Run Go Generate + run: go generate ./... + + - name: Validate Generated Files are up to date + run: | + if git diff --quiet; then + echo "No changes found." + else + echo "Changes detected. Here are the details:" + git diff + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5da6ad01..707010d6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,9 +23,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: Build the website - run: | - make web-build - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index f32213f11..89b934037 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -24,7 +24,7 @@ before: hooks: - go mod tidy - go generate ./... - - make web-build USE_DOCKER=1 + - make web-build builds: - env: - CGO_ENABLED=0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 668c3c9a4..8c44d9398 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,6 +25,7 @@ repos: - id: trailing-whitespace exclude: github_scripts/pelican_protocol.patch - id: end-of-file-fixer + exclude-types: [json] - id: check-yaml # Multi-documents are yaml files with multiple --- separating blocks, like # in our docs/parameters.yaml. We need this argument so those parse. diff --git a/docs/parameters.json b/docs/parameters.json index 591f5f006..17c43b1b8 100644 --- a/docs/parameters.json +++ b/docs/parameters.json @@ -2376,4 +2376,4 @@ "type": "string" } } -] \ No newline at end of file +] diff --git a/docs/parameters.yaml b/docs/parameters.yaml index 33dacf307..b86fc9c9c 100644 --- a/docs/parameters.yaml +++ b/docs/parameters.yaml @@ -152,7 +152,7 @@ name: Logging.DisableProgressBars description: >- A bool defining if progress bars should be enabled or not. type: bool -default: false +default: true components: ["Client"] --- name: Logging.Origin.Cms diff --git a/images/Dockerfile b/images/Dockerfile index a19348b3d..9a1ceb9f3 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -19,20 +19,11 @@ ARG BASE_YUM_REPO=release ARG BASE_OSG_SERIES=3.6 -FROM node:20 AS website-build - -WORKDIR /webapp - -COPY web_ui/frontend/package.json package.json - -RUN npm install -COPY web_ui/frontend ./ - -RUN npm run build - FROM goreleaser/goreleaser:v1.21.0 AS pelican-build ARG IS_NONRELEASE_BUILD="true" +RUN apk add --update nodejs-current npm + WORKDIR /pelican COPY . . diff --git a/web_ui/frontend/public/data/parameters.json b/web_ui/frontend/public/data/parameters.json index 591f5f006..17c43b1b8 100644 --- a/web_ui/frontend/public/data/parameters.json +++ b/web_ui/frontend/public/data/parameters.json @@ -2376,4 +2376,4 @@ "type": "string" } } -] \ No newline at end of file +]