Skip to content

Commit

Permalink
Use release-it to store package version in src (#748)
Browse files Browse the repository at this point in the history
* ci: reflect module splitting in dockerfile (untested)

* refactor: bad copy-paste

* dep: updated submodules

* ci: ensure we check out submodules for docker deploy

* feat-fix: fixed outdated paths after refactor

* feat-fix: fixed up dockerfile

* refactor: dockerfile cleanup

* refactor: we don't need to copy to dist

* dep: use release-it-regex-bumper to avoid packaging package.json

* ci: fix run-suite path

* dep: updated cli submodule

* refactor: updated docker paths to reflect new directory structure

* refactor: explicitly omit test sources in docker

Co-authored-by: Florian Sihler <[email protected]>
  • Loading branch information
Ellpeck and EagleoutIce authored Apr 2, 2024
1 parent cc43e18 commit 97572ac
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modules/cli
Submodule cli updated from 6a4c41 to 1f6ccd
103 changes: 103 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@
"after:bump": "npm run build",
"after:git:release": "echo After git push, before github release",
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
},
"plugins": {
"@j-ulrich/release-it-regex-bumper": {
"out": {
"file": "src/util/version.ts",
"search": "const version = '[\\d.]+'",
"replace": "const version = '{{version}}'"
}
}
}
},
"devDependencies": {
Expand Down Expand Up @@ -239,7 +248,8 @@
"typedoc-plugin-missing-exports": "^2.1.0",
"typedoc-theme-hierarchy": "^4.1.2",
"typedoc-umlclass": "^0.8.0",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"@j-ulrich/release-it-regex-bumper": "^5.1.0"
},
"dependencies": {
"@types/semver": "^7.5.6",
Expand Down
18 changes: 11 additions & 7 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ FROM node:21.4-alpine3.19 AS builder

WORKDIR /app

# copy all modules into the workdir
COPY ./src /app/src/
# copy the source and build files of all modules into the workdir
# (by doing this, we explicitly omit test sources)
COPY ./src /app/src
COPY ./package.json ./package-lock.json ./tsconfig.json /app/
COPY ./modules/benchmark /app/modules/benchmark
COPY ./modules/cli /app/modules/cli
COPY ./modules/statistics /app/modules/statistics
COPY ./modules/benchmark/src /app/modules/benchmark/src
COPY ./modules/benchmark/package.json ./modules/benchmark/package-lock.json ./modules/benchmark/tsconfig.json /app/modules/benchmark/
COPY ./modules/cli/src /app/modules/cli/src
COPY ./modules/cli/package.json ./modules/cli/package-lock.json ./modules/cli/tsconfig.json /app/modules/cli/
COPY ./modules/statistics/src /app/modules/statistics/src
COPY ./modules/statistics/package.json ./modules/statistics/package-lock.json ./modules/statistics/tsconfig.json /app/modules/statistics/

# install and build all modules
RUN npm install && npm run build
Expand Down Expand Up @@ -41,9 +45,9 @@ RUN cd modules/benchmark && npm install --omit=dev
RUN cd modules/cli && npm install --omit=dev
RUN cd modules/statistics && npm install --omit=dev

COPY --from=builder /app/dist/src /app/dist
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/modules/benchmark/dist /app/modules/benchmark/dist
COPY --from=builder /app/modules/cli/dist/src /app/modules/cli/dist
COPY --from=builder /app/modules/cli/dist /app/modules/cli/dist
COPY --from=builder /app/modules/statistics/dist /app/modules/statistics/dist

RUN rm -rf /app/**/tsconfig.tsbuildinfo
Expand Down
4 changes: 3 additions & 1 deletion src/util/version.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { version } from '../../package.json'
import { SemVer } from 'semver'

// this is automatically replaced with the current version by release-it
const version = '1.0.0'

export function flowrVersion(): SemVer {
return new SemVer(version)
}
4 changes: 2 additions & 2 deletions test/performance/run-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ echo "done."
FILES_DIR="$(pwd)/files/"

## run the benchmark script for each file
CMD=(npm run benchmark --prefix ../../../cli -- --parallel "${PARALLEL}" --runs "${RUNS}" --output "${RAW_OUTPUT}" "${FILES_DIR}")
CMD=(npm run benchmark --prefix ../../../modules/cli -- --parallel "${PARALLEL}" --runs "${RUNS}" --output "${RAW_OUTPUT}" "${FILES_DIR}")

echo -e " * Running: \"${CMD[*]}\"...\033[33m"
"${CMD[@]}"
echo -e "\033[0m * Done (written to ${RAW_OUTPUT})."
echo " * Summarizing results to ${OUTPUT_FILE}${ULTIMATE_SUMMARY_SUFFIX}..."

CMD=(npm run summarizer --prefix ../../../cli -- --input "${RAW_OUTPUT}" --output "${OUTPUT_FILE}" --graph)
CMD=(npm run summarizer --prefix ../../../modules/cli -- --input "${RAW_OUTPUT}" --output "${OUTPUT_FILE}" --graph)
echo -e " * Running: \"${CMD[*]}\"...\033[33m"
"${CMD[@]}"
echo -e "\033[0m * Done (written to ${OUTPUT_FILE}${ULTIMATE_SUMMARY_SUFFIX})."
Expand Down

0 comments on commit 97572ac

Please sign in to comment.