From a335b16abdb253df0e230211da2aea5f5acb0476 Mon Sep 17 00:00:00 2001 From: Donkie Date: Mon, 24 Jul 2023 19:55:56 +0200 Subject: [PATCH 1/2] Added client dev section to README --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index cb0ebbc..233203f 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,23 @@ If you want to connect with an external database instead, specify the `SPOOLMAN_ ## Configuration ### Moonraker Moonraker has built-in support for Spoolman. See the [Moonraker Documentation](https://moonraker.readthedocs.io/en/latest/configuration/#spoolman) for more information. + +## Development +### Client +To test out changes to the web client, the best way is to run it in development mode. + +Prerequisities: +* NodeJS 16 or above installed, along with NPM. Running `node --version` should print a correct version. +* A running Spoolman server, with the following two environment variables added in the `docker-compose.yml`: +```yaml + environment: + - FORWARDED_ALLOW_IPS=* + - SPOOLMAN_DEBUG_MODE=TRUE +``` + +Instructions: +1. Open a terminal and CD to the `client` subdirectory +2. Run `npm install`. If it doesn't succeed, you probably have an incorrect node version. Spoolman is only tested on NodeJS 16. +3. Run `echo "VITE_APIURL=http://192.168.0.123:7901/api/v1" > .env`, where the ip:port is the address of the running Spoolman server. This should create a `.env` file in the `client` directory. If you don't already have one running on your network, you can start one up using the `docker-compose.yml` showed above. +4. Run `npm run dev`. The terminal will print a "Local: xxxx" URL, open that in your browser and the web client should show up. Your existing spools etc in your Spoolman database should be loaded in. +5. Any edits in .ts/.tsx files will be automatically reloaded in your browser. If you make any change to .json files you will need to F5 in your browser. From 7c23156d85020bb4374157121f482aebb83aaa7c Mon Sep 17 00:00:00 2001 From: Donkie Date: Tue, 25 Jul 2023 23:06:33 +0200 Subject: [PATCH 2/2] Don't cache builds for PRs Doesn't work since they don't have access to write to the registry. --- .github/workflows/ci.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8be078a..fbab29d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: - master tags: - - 'v*' + - "v*" pull_request: branches: - master @@ -54,6 +54,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build Spoolman + if: ${{ github.event_name != 'pull_request' }} uses: docker/build-push-action@v4 with: context: . @@ -62,6 +63,16 @@ jobs: cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64 cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64,mode=max + # Separate build for pull requests since PRs dont have access to store cache + - name: Build Spoolman (PR) + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v4 + with: + context: . + tags: ${{ env.IMAGE_NAME }}:test + outputs: type=docker,dest=/tmp/spoolman.tar + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64 + - name: Upload artifact uses: actions/upload-artifact@v3 with: @@ -87,6 +98,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build Spoolman Tester + if: ${{ github.event_name != 'pull_request' }} uses: docker/build-push-action@v4 with: context: ./tests_integration @@ -95,6 +107,16 @@ jobs: cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester,mode=max + # Separate build for pull requests since PRs dont have access to store cache + - name: Build Spoolman Tester (PR) + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v4 + with: + context: ./tests_integration + tags: ${{ env.IMAGE_NAME }}-tester:latest + outputs: type=docker,dest=/tmp/spoolman-tester.tar + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester + - name: Upload artifact uses: actions/upload-artifact@v3 with: