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

Import parameters.json into website #972

Merged
merged 1 commit into from
Mar 27, 2024
Merged
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
27 changes: 27 additions & 0 deletions .github/workflows/go-generate-check.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ before:
hooks:
- go mod tidy
- go generate ./...
- make web-build
CannonLock marked this conversation as resolved.
Show resolved Hide resolved
builds:
- env:
- CGO_ENABLED=0
Expand Down
13 changes: 13 additions & 0 deletions generate/param_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ func GenParamEnum() {
if err != nil {
panic(err)
}

// Skip writing the file if it is the same as the existing file
// This is so that the file is not updated if it is not changed making builds faster
if _, err := os.Stat("../docs/parameters.json"); err == nil {
existingJsonBytes, err := os.ReadFile("../docs/parameters.json")
if err != nil {
panic(err)
}
if bytes.Equal(existingJsonBytes, prettyJSON.Bytes()) {
return
}
}

// Create the json file to be generated (for the documentation website)
fJSON, err := os.Create("../docs/parameters.json")
if err != nil {
Expand Down
16 changes: 2 additions & 14 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,14 @@
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 . .
COPY --from=website-build /webapp/out ./web_ui/frontend/out
# Remove generate package as we already had generated structs in the repo
RUN rm -rf ./generate

ENV GOOS="linux"
ENV GOARCH="amd64"
Expand Down
Loading