[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

ci: Make test workflow reusable and add run sanity check

* Add sanity run steps to check for obvious errors when running in production
* Refactor test job to be reusable

FoxxMD (Oct 10, 2024, 12:05 PM EDT) 1b0e7a3d abc5d186

+70 -73
+8 -2
.github/act/README.md
··· 12 12 docker run -d --name artifact-server -p 8082:8080 --add-host host.docker.internal:host-gateway -e AUTH_KEY=foo ghcr.io/jefuller/artifact-server:latest 13 13 ``` 14 14 15 - Run the following **from this directory** to make use of `.actrc` and proper working directoy. 15 + Run the following **from this directory** to make use of `.actrc` and proper working directory. 16 + 17 + ### Test Branch Test Suite 18 + 19 + ```shell 20 + act -W '.github/act/testSuite.yml' -e '.github/act/actBranchEvent.json' 21 + ``` 16 22 17 23 ### Test Branch Push 18 24 ··· 44 50 45 51 ```shell 46 52 act -W '.github/act/multiRunnerBakeTest.yml' -e '.github/act/actBranchEvent.json' 47 - ``` 53 + ```
+1 -16
.github/act/testSuite.yml
··· 7 7 8 8 jobs: 9 9 test: 10 - name: Run Tests 11 - runs-on: ubuntu-latest 12 - steps: 13 - - name: Check out the repo 14 - uses: actions/checkout@v4 15 - - name: Use Node.js 16 - uses: actions/setup-node@v4 17 - with: 18 - node-version: '18.x' 19 - cache: 'npm' 20 - - name: Install dev dependencies 21 - run: npm ci 22 - - name: Build Backend 23 - run: 'npm run build:backend' 24 - - name: Test Backend 25 - run: npm run test 10 + uses: ./.github/workflows/testAndSanity.yml
+2 -20
.github/workflows/dependabotTest.yml
··· 11 11 12 12 jobs: 13 13 test: 14 - name: Run Tests and Build (sanity) 14 + name: Tests / Build / Sanity Run 15 15 if: github.actor == 'dependabot[bot]' 16 - runs-on: ubuntu-latest 17 - steps: 18 - - name: Check out the repo 19 - uses: actions/checkout@v4 20 - - name: Use Node.js 21 - uses: actions/setup-node@v4 22 - with: 23 - node-version: '18.x' 24 - cache: 'npm' 25 - - name: Install dev dependencies 26 - run: npm ci 27 - - name: Build Backend 28 - run: 'npm run build:backend' 29 - - name: Test Backend 30 - run: npm run test 31 - - name: Install Docs Deps 32 - run: npm run docs:install 33 - - name: Build 34 - run: npm run build 16 + uses: ./.github/workflows/testAndSanity.yml
+1 -19
.github/workflows/pr.yml
··· 12 12 13 13 jobs: 14 14 test: 15 - name: Run Tests 16 - runs-on: ubuntu-latest 17 15 if: contains(github.event.pull_request.labels.*.name, 'safe to test') 18 - steps: 19 - - name: Check out the repo 20 - uses: actions/checkout@v4 21 - - name: Use Node.js 22 - uses: actions/setup-node@v4 23 - with: 24 - node-version: '18.x' 25 - cache: 'npm' 26 - - name: Install dev dependencies 27 - run: npm ci 28 - - name: Build Backend 29 - run: 'npm run build:backend' 30 - - name: Test Backend 31 - run: npm run test 16 + uses: ./.github/workflows/testAndSanity.yml 32 17 33 18 release-snapshot: 34 19 name: Release snapshot ··· 45 30 - dockerfile: ./Dockerfile 46 31 suffix: '' 47 32 platforms: 'linux/amd64,linux/arm64' 48 - # - dockerfile: ./alpine.Dockerfile 49 - # suffix: '-alpine' 50 - # platforms: 'linux/amd64,linux/arm64' 51 33 steps: 52 34 - name: Set up QEMU 53 35 uses: docker/setup-qemu-action@v3
+1 -16
.github/workflows/publishImage.yml
··· 20 20 21 21 jobs: 22 22 test: 23 - name: Run Tests 24 23 if: github.event_name != 'pull_request' 25 - runs-on: ubuntu-latest 26 - steps: 27 - - name: Check out the repo 28 - uses: actions/checkout@v4 29 - - name: Use Node.js 30 - uses: actions/setup-node@v4 31 - with: 32 - node-version: '18.x' 33 - cache: 'npm' 34 - - name: Install dev dependencies 35 - run: npm ci 36 - - name: Build Backend 37 - run: 'npm run build:backend' 38 - - name: Test Backend 39 - run: npm run test 24 + uses: ./.github/workflows/testAndSanity.yml 40 25 41 26 push_to_registry: 42 27 name: Build and push container images
+57
.github/workflows/testAndSanity.yml
··· 1 + name: Tests and Sanity Run 2 + 3 + on: 4 + workflow_call: 5 + inputs: 6 + node-version: 7 + description: "Node version" 8 + required: false 9 + default: '18.x' 10 + type: string 11 + 12 + jobs: 13 + test: 14 + name: Tests / Build / Sanity Run 15 + runs-on: ubuntu-latest 16 + steps: 17 + - name: Check out the repo 18 + uses: actions/checkout@v4 19 + - name: Use Node.js 20 + uses: actions/setup-node@v4 21 + with: 22 + node-version: ${{ inputs.node-version }} 23 + cache: 'npm' 24 + 25 + - name: Install dev dependencies 26 + run: npm ci 27 + - name: Test Backend 28 + run: npm run test 29 + 30 + - name: Install Docs Deps 31 + run: NODE_ENV=production npm run docs:install 32 + - name: Build 33 + run: NODE_ENV=production npm run build 34 + 35 + # remove modules that might include dev stuff 36 + # so that in the next step we are sure that prod-only runs work correctly 37 + - name: Install Prod Deps 38 + run: | 39 + rm -rf node_modules && \ 40 + rm -rf docsite/node_modules && \ 41 + NODE_ENV=production npm ci --omit=dev 42 + 43 + # run app for 10 seconds as sanity check to see if it errors for any reason 44 + # easy testcase for missing packages and init errors 45 + - name: Sanity Run 46 + run: | 47 + set +e 48 + export NODE_ENV=production 49 + timeout --preserve-status 10s node node_modules/.bin/tsx src/backend/index.ts 50 + exitcode="$?" 51 + if [[ "$exitcode" -eq 143 ]] || [[ "$exitcode" -eq 137 ]]; then 52 + echo "App stayed up long enough and exited with expected status" 53 + exit 0 54 + else 55 + echo "App exited with unexpected code $exitcode" 56 + exit "$exitcode" 57 + fi