From bcf2d0af404a3ffe0997c30ac61f286c1f7ce249 Mon Sep 17 00:00:00 2001 From: Damien Menanteau Date: Wed, 13 Mar 2024 11:38:44 +0100 Subject: [PATCH] Integrate webapp build into goreleaser setup --- .github/workflows/go.yml | 2 +- .github/workflows/go_releaser.yml | 11 ++++++++++- .github/workflows/npm.yml | 6 +++--- .goreleaser.yml | 3 ++- src/settings/build_info.go | 5 ++--- src/settings/build_info_test.go | 2 +- webapp/Makefile | 3 +++ webapp/package.json | 8 ++++++-- .../app/components/tcr-about/tcr-about.component.html | 5 ++--- 9 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 466f220c..c121dc78 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -29,7 +29,7 @@ jobs: with: fetch-depth: 0 - - name: Skip Duplicate Actions + - name: Skip duplicate actions uses: fkirc/skip-duplicate-actions@v5.3.1 - name: Set up Go diff --git a/.github/workflows/go_releaser.yml b/.github/workflows/go_releaser.yml index f8d81433..0b111435 100644 --- a/.github/workflows/go_releaser.yml +++ b/.github/workflows/go_releaser.yml @@ -24,7 +24,16 @@ jobs: go-version: '1.21' check-latest: true cache-dependency-path: src/go.sum - - name: Run GoReleaser + - name: Setup node.js + uses: actions/setup-node@v4 + with: + node-version: '21' + cache: 'npm' + cache-dependency-path: webapp/package-lock.json + - name: Run npm install + working-directory: webapp + run: npm ci + - name: Run goreleaser uses: goreleaser/goreleaser-action@v5 with: # either 'goreleaser' (default) or 'goreleaser-pro' diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 52e5a8a7..836ff7e9 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -27,17 +27,17 @@ jobs: with: fetch-depth: 0 - - name: Skip Duplicate Actions + - name: Skip duplicate actions uses: fkirc/skip-duplicate-actions@v5.3.1 - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup node.js version ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' cache-dependency-path: webapp/package-lock.json - - name: Install npm + - name: Run npm install run: npm ci - name: Run tests diff --git a/.goreleaser.yml b/.goreleaser.yml index e94fd70a..7f3ade66 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -4,6 +4,7 @@ project_name: tcr before: hooks: - make tidy + - make -C webapp build builds: - id: "tcr" dir: src @@ -18,7 +19,7 @@ builds: - -X {{.Env.CONFIG_PKG}}.BuildArch={{.Arch}} - -X {{.Env.CONFIG_PKG}}.BuildCommit={{.Commit}} - -X {{.Env.CONFIG_PKG}}.BuildDate={{.Date}} - - -X {{.Env.CONFIG_PKG}}.BuildAuthor=goreleaser + - -X {{.Env.CONFIG_PKG}}.BuildAuthor=murex goos: - linux - windows diff --git a/src/settings/build_info.go b/src/settings/build_info.go index 7a4f0276..ecb84841 100644 --- a/src/settings/build_info.go +++ b/src/settings/build_info.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2023 Murex +Copyright (c) 2024 Murex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -24,7 +24,6 @@ package settings import ( "fmt" - "time" ) // Below variables are set at build time through -ldflags @@ -33,7 +32,7 @@ var ( BuildOs = "unknown" BuildArch = "unknown" BuildCommit = "none" - BuildDate = time.Time{}.Format(time.RFC3339) + BuildDate = "0001-01-01T00:00:00Z" BuildAuthor = "unknown" ) diff --git a/src/settings/build_info_test.go b/src/settings/build_info_test.go index f9a47b7c..a9192183 100644 --- a/src/settings/build_info_test.go +++ b/src/settings/build_info_test.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2022 Murex +Copyright (c) 2024 Murex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/webapp/Makefile b/webapp/Makefile index b419a867..99cb8bd6 100644 --- a/webapp/Makefile +++ b/webapp/Makefile @@ -29,3 +29,6 @@ build: setup run: @npm start +.PHONY: clean +clean: + @npm run clean diff --git a/webapp/package.json b/webapp/package.json index 7c9905df..25196b3a 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -10,7 +10,11 @@ "test": "ng test --source-map=false --browsers=ChromeHeadless --watch=false", "test-cov": "ng test --source-map=false --browsers=ChromeHeadless --watch=false --code-coverage", "test-watch": "ng test", - "lint": "ng lint" + "lint": "ng lint", + "clean": "rm -rf node_modules ../src/http/static/webapp", + "reinstall": "npm run clean && npm install", + "rebuild": "npm run reinstall && npm run build", + "rebuild-prod": "npm run reinstall && npm run build-prod" }, "private": true, "dependencies": { @@ -59,4 +63,4 @@ "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.2.2" } -} \ No newline at end of file +} diff --git a/webapp/src/app/components/tcr-about/tcr-about.component.html b/webapp/src/app/components/tcr-about/tcr-about.component.html index 96571f8b..74286441 100644 --- a/webapp/src/app/components/tcr-about/tcr-about.component.html +++ b/webapp/src/app/components/tcr-about/tcr-about.component.html @@ -14,7 +14,6 @@

{{ title }}

Running TCR Version

- @@ -44,8 +43,8 @@

Running TCR Ve

TCR on GitHub

Willing to contribute? -
TCR is available as open-source on GitHub at -
github.com/murex/TCR +
TCR is available on GitHub at + github.com/murex/TCR

TCR Build Information
Version {{ buildInfo.version }}