[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.

Add multi-runner WIP tests to ACT

Would like to move to this to improve build time on GH Actions but its not working yet. Will also be good when GH Runners release arm nodes publicly.

FoxxMD (Sep 27, 2024, 4:30 PM EDT) 5adb8311 5b8a8a74

+493 -7
+2 -1
.dockerignore
··· 24 24 build 25 25 *.secrets 26 26 .devcontainer 27 - .vscode 27 + .vscode 28 + **/act/*
+3 -1
.github/act/.actrc
··· 1 1 --directory ../../ 2 2 --env-file .github/act/.env 3 - --secret-file .github/act/.secrets 3 + --secret-file .github/act/.secrets 4 + --artifact-server-path out 5 + #--action-offline-mode
+5 -1
.github/act/.env.example
··· 1 - NO_DOCKER_BUILD=true 1 + NO_DOCKER_BUILD=true 2 + #https://github.com/nektos/act/issues/329#issuecomment-1905955589 3 + ACTIONS_RUNTIME_URL=http://YOUR_HOST_IP:8082/ 4 + ACTIONS_RUNTIME_TOKEN=foo 5 + ACTIONS_CACHE_URL=http://YOUR_HOST_IP:8082/
+22 -2
.github/act/README.md
··· 1 - Testing GH Actions with [ACT] 1 + Testing GH Actions with ACT 2 2 3 3 Need to have credentials in a [`.secrets` file](https://nektosact.com/usage/index.html#secrets), copy and rename [`.secrets.example`](./secrets.example) to `.secrets`, then fill out blank fields. Required for docker/metadata-action to read...something. Fails with `Parameter token or opts.auth is required` if they are not supplied. 4 4 5 - An ENV file can also be made by copy and renaming [`.env.example`](./env.example). Set `NO_DOCKER_BUILD=true` if you only want to test APP_VERSION and docker tags output. 5 + An ENV file can also be made by copy and renaming [`.env.example`](./env.example). Set `NO_DOCKER_BUILD=true` if you only want to test APP_VERSION and docker tags output. 6 + 7 + If running a full docker build for multi-runner workflows you will need to create an [artifact server](https://github.com/nektos/act/issues/329#issuecomment-1905955589) for ACT to work: 8 + 9 + 10 + ```shell 11 + docker pull ghcr.io/jefuller/artifact-server:latest 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 + ``` 6 14 7 15 Run the following **from this directory** to make use of `.actrc` and proper working directoy. 8 16 ··· 25 33 ```shell 26 34 act -W '.github/act/actTest.yml' -e '.github/act/actTagPreEvent.json' 27 35 ``` 36 + 37 + ### Test Multi-Runner Push (WIP) 38 + 39 + ```shell 40 + act -W '.github/act/multiRunnerTest.yml' -e '.github/act/actBranchEvent.json' 41 + ``` 42 + 43 + ### Test Multi-Runner Bake Push (WIP) 44 + 45 + ```shell 46 + act -W '.github/act/multiRunnerBakeTest.yml' -e '.github/act/actBranchEvent.json' 47 + ```
+2 -2
.github/act/actTagPreEvent.json
··· 1 1 { 2 - "ref": "refs/tags/0.8.5-rc1", 3 - "ref_name": "0.8.5-rc1", 2 + "ref": "refs/tags/0.8.5-gh-runner", 3 + "ref_name": "0.8.5-gh-runner", 4 4 "before": "0000000000000000000000000000000000000000", 5 5 "after": "005dae76ab51799d3d55112738e301cb1af0dafd", 6 6 "sha": "005dae76ab51799d3d55112738e301cb1af0dafd",
+30
.github/act/docker-bake.hcl
··· 1 + variable "DEFAULT_TAG" { 2 + default = "multi-scrobbler:local" 3 + } 4 + 5 + // Special target: https://github.com/docker/metadata-action#bake-definition 6 + target "docker-metadata-action" { 7 + tags = ["${DEFAULT_TAG}"] 8 + } 9 + 10 + // Default target if none specified 11 + group "default" { 12 + targets = ["image-local"] 13 + } 14 + 15 + target "image" { 16 + inherits = ["docker-metadata-action"] 17 + } 18 + 19 + target "image-local" { 20 + inherits = ["image"] 21 + output = ["type=docker"] 22 + } 23 + 24 + target "image-all" { 25 + inherits = ["image"] 26 + platforms = [ 27 + "linux/amd64", 28 + "linux/arm64" 29 + ] 30 + }
+233
.github/act/multiRunnerBakeTest.yml
··· 1 + # Based on https://docs.docker.com/build/ci/github-actions/multi-platform/#with-bake (https://github.com/docker/build-push-action/issues/671#issuecomment-1609106171) 2 + # with example from here https://github.com/crazy-max/docker-linguist/blob/master/.github/workflows/build.yml that uses caching 3 + # 4 + # may have to use this to enable pushing to multiple registries? https://github.com/docker/build-push-action/discussions/1067#discussioncomment-8677682 5 + 6 + name: build 7 + 8 + concurrency: 9 + group: ${{ github.workflow }}-${{ github.ref }} 10 + cancel-in-progress: true 11 + 12 + on: 13 + push: 14 + branches: 15 + - 'master' 16 + tags: 17 + - '*.*.*' 18 + paths-ignore: 19 + - 'README.md' 20 + - '.github/**' 21 + - 'flatpak/**' 22 + 23 + env: 24 + DOCKERHUB_SLUG: foxxmd/multi-scrobbler 25 + GHCR_SLUG: ghcr.io/foxxmd/multi-scrobbler 26 + 27 + jobs: 28 + prepare: 29 + runs-on: ubuntu-latest 30 + outputs: 31 + matrix: ${{ steps.platforms.outputs.matrix }} 32 + steps: 33 + - 34 + name: Checkout 35 + uses: actions/checkout@v4 36 + 37 + - name: Set short git commit SHA 38 + id: appvars 39 + # https://dev.to/hectorleiva/github-actions-and-creating-a-short-sha-hash-8b7 40 + # short sha available under env.COMMIT_SHORT_SHA 41 + run: | 42 + calculatedSha=$(git rev-parse --short HEAD) 43 + branchName=$(git rev-parse --abbrev-ref HEAD) 44 + echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV 45 + echo "COMMIT_BRANCH=$branchName" >> $GITHUB_ENV 46 + 47 + - name: Get App Version 48 + id: appversion 49 + env: 50 + # use release instead of tags once version is correctly parsed 51 + #APP_VERSION: ${{ github.event.release.tag_name }} 52 + 53 + # https://github.com/actions/runner/issues/409#issuecomment-752775072 54 + # https://stackoverflow.com/a/69919067/1469797 55 + APP_VERSION: ${{ contains(github.ref, 'refs/tags/') && github.ref_name || format('{0}-{1}', env.COMMIT_BRANCH, env.COMMIT_SHORT_SHA ) }} 56 + run: | 57 + echo appversion=$APP_VERSION >>${GITHUB_OUTPUT} 58 + 59 + - 60 + name: Create matrix 61 + id: platforms 62 + run: | 63 + echo "matrix=$(docker buildx bake --file ./docker-bake.hcl image-all --print | jq -cr '.target."image-all".platforms')" >>${GITHUB_OUTPUT} 64 + - 65 + name: Show matrix 66 + run: | 67 + echo ${{ steps.platforms.outputs.matrix }} 68 + - 69 + name: Docker meta 70 + id: meta 71 + uses: docker/metadata-action@v5 72 + with: 73 + images: | 74 + ${{ env.DOCKERHUB_SLUG }} 75 + ${{ env.GHCR_SLUG }} 76 + tags: | 77 + type=edge 78 + 79 + # maybe re-enable branch-named tags in the futures 80 + #type=ref,event=branch,enable=${{ !endsWith(github.ref, 'master') }} 81 + 82 + # tag non-prelease as latest -- has a higher priority than regular tag so it shows first in registries 83 + type=match,pattern=\d.\d.\d$,priority=901 84 + 85 + # tag all semver (include pre-release) 86 + type=semver,pattern={{version}} 87 + labels: | 88 + org.opencontainers.image.title=Multi-Scrobbler 89 + org.opencontainers.image.description=Scrobble from many sources to many clients 90 + org.opencontainers.image.vendor=FoxxMD 91 + - 92 + name: Rename meta bake definition file 93 + run: | 94 + mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json" 95 + - 96 + name: Upload meta bake definition 97 + uses: actions/upload-artifact@v3 98 + with: 99 + name: bake-meta 100 + path: /tmp/bake-meta.json 101 + if-no-files-found: error 102 + retention-days: 1 103 + 104 + build: 105 + runs-on: ubuntu-latest 106 + needs: 107 + - prepare 108 + strategy: 109 + fail-fast: false 110 + matrix: 111 + platform: ${{ fromJson(needs.prepare.outputs.matrix) }} 112 + steps: 113 + - 114 + name: Prepare 115 + run: | 116 + platform=${{ matrix.platform }} 117 + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV 118 + - 119 + name: Checkout 120 + uses: actions/checkout@v4 121 + - 122 + name: Test App Version Transfer 123 + run: | 124 + echo "App Version in Build ${{ needs.prepare.appversion.outputs.appversion }}" 125 + - 126 + name: Download meta bake definition 127 + uses: actions/download-artifact@v3 128 + with: 129 + name: bake-meta 130 + path: /tmp 131 + - 132 + name: Set up QEMU 133 + uses: docker/setup-qemu-action@v3 134 + - 135 + name: Set up Docker Buildx 136 + uses: docker/setup-buildx-action@v3 137 + with: 138 + buildkitd-flags: "--debug" 139 + - 140 + name: Login to DockerHub 141 + if: github.event_name != 'pull_request' 142 + uses: docker/login-action@v3 143 + with: 144 + username: ${{ secrets.DOCKER_USERNAME }} 145 + password: ${{ secrets.DOCKER_PASSWORD }} 146 + - 147 + name: Login to GHCR 148 + if: github.event_name != 'pull_request' 149 + uses: docker/login-action@v3 150 + with: 151 + registry: ghcr.io 152 + username: ${{ github.repository_owner }} 153 + password: ${{ secrets.GITHUB_TOKEN }} 154 + - 155 + name: Build 156 + id: bake 157 + uses: docker/bake-action@v5 158 + with: 159 + files: | 160 + ./.github/act/docker-bake.hcl 161 + /tmp/bake-meta.json 162 + targets: image 163 + set: | 164 + *.args.APP_BUILD_VERSION=${{ needs.prepare.appversion.outputs.appversion }} 165 + *.tags= 166 + *.platform=${{ matrix.platform }} 167 + *.cache-from=type=gha,scope=build-${{ env.PLATFORM_PAIR }} 168 + *.cache-to=type=gha,scope=build-${{ env.PLATFORM_PAIR }} 169 + *.output=type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} 170 + - 171 + name: Export digest 172 + run: | 173 + mkdir -p /tmp/digests 174 + digest="${{ fromJSON(steps.bake.outputs.metadata).image['containerimage.digest'] }}" 175 + touch "/tmp/digests/${digest#sha256:}" 176 + - 177 + name: Upload digest 178 + uses: actions/upload-artifact@v3 179 + with: 180 + name: digests-${{ env.PLATFORM_PAIR }} 181 + path: /tmp/digests/* 182 + if-no-files-found: error 183 + retention-days: 1 184 + 185 + merge: 186 + runs-on: ubuntu-latest 187 + if: github.event_name != 'pull_request' 188 + needs: 189 + - build 190 + steps: 191 + - 192 + name: Download meta bake definition 193 + uses: actions/download-artifact@v3 194 + with: 195 + name: bake-meta 196 + path: /tmp 197 + - 198 + name: Download digests 199 + uses: actions/download-artifact@v3 200 + with: 201 + path: /tmp/digests 202 + pattern: digests-* 203 + merge-multiple: true 204 + - 205 + name: Set up Docker Buildx 206 + uses: docker/setup-buildx-action@v3 207 + - 208 + name: Login to DockerHub 209 + uses: docker/login-action@v3 210 + with: 211 + username: ${{ secrets.DOCKER_USERNAME }} 212 + password: ${{ secrets.DOCKER_PASSWORD }} 213 + - 214 + name: Login to GHCR 215 + uses: docker/login-action@v3 216 + with: 217 + registry: ghcr.io 218 + username: ${{ github.repository_owner }} 219 + password: ${{ secrets.GITHUB_TOKEN }} 220 + - 221 + name: Create manifest list and push 222 + working-directory: /tmp/digests 223 + run: | 224 + docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.DOCKERHUB_SLUG }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ 225 + $(printf '${{ env.DOCKERHUB_SLUG }}@sha256:%s ' *) 226 + docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.GHCR_SLUG }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ 227 + $(printf '${{ env.GHCR_SLUG }}@sha256:%s ' *) 228 + - 229 + name: Inspect image 230 + run: | 231 + tag=$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta.json) 232 + docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${tag} 233 + docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${tag}
+195
.github/act/multiRunnerTest.yml
··· 1 + # Based on https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners 2 + 3 + name: build 4 + 5 + concurrency: 6 + group: ${{ github.workflow }}-${{ github.ref }} 7 + cancel-in-progress: true 8 + 9 + on: 10 + push: 11 + branches: 12 + - 'master' 13 + tags: 14 + - '*.*.*' 15 + paths-ignore: 16 + - 'README.md' 17 + - '.github/**' 18 + - 'flatpak/**' 19 + 20 + env: 21 + DOCKERHUB_SLUG: foxxmd/multi-scrobbler 22 + GHCR_SLUG: ghcr.io/foxxmd/multi-scrobbler 23 + 24 + jobs: 25 + build: 26 + runs-on: ubuntu-latest 27 + permissions: 28 + packages: write 29 + contents: read 30 + strategy: 31 + fail-fast: false 32 + matrix: 33 + platform: 34 + - linux/amd64 35 + - linux/arm64 36 + steps: 37 + - name: Prepare 38 + run: | 39 + platform=${{ matrix.platform }} 40 + echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV 41 + 42 + - name: Check out the repo 43 + uses: actions/checkout@v4 44 + 45 + - name: Set short git commit SHA 46 + id: appvars 47 + # https://dev.to/hectorleiva/github-actions-and-creating-a-short-sha-hash-8b7 48 + # short sha available under env.COMMIT_SHORT_SHA 49 + run: | 50 + calculatedSha=$(git rev-parse --short HEAD) 51 + branchName=$(git rev-parse --abbrev-ref HEAD) 52 + echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV 53 + echo "COMMIT_BRANCH=$branchName" >> $GITHUB_ENV 54 + 55 + - name: Get App Version 56 + id: appversion 57 + env: 58 + # use release instead of tags once version is correctly parsed 59 + #APP_VERSION: ${{ github.event.release.tag_name }} 60 + 61 + # https://github.com/actions/runner/issues/409#issuecomment-752775072 62 + # https://stackoverflow.com/a/69919067/1469797 63 + APP_VERSION: ${{ contains(github.ref, 'refs/tags/') && github.ref_name || format('{0}-{1}', env.COMMIT_BRANCH, env.COMMIT_SHORT_SHA ) }} 64 + run: | 65 + echo appversion=$APP_VERSION >>${GITHUB_OUTPUT} 66 + 67 + - name: Extract metadata (tags, labels) for Docker 68 + id: meta 69 + uses: docker/metadata-action@v5 70 + with: 71 + images: | 72 + ${{ env.DOCKERHUB_SLUG }} 73 + ${{ env.GHCR_SLUG }} 74 + labels: | 75 + org.opencontainers.image.title=Multi-Scrobbler 76 + org.opencontainers.image.description=Scrobble from many sources to many clients 77 + org.opencontainers.image.vendor=FoxxMD 78 + 79 + - name: Set up QEMU 80 + uses: docker/setup-qemu-action@v3 81 + 82 + - name: Set up Docker Buildx 83 + uses: docker/setup-buildx-action@v3 84 + 85 + - name: Login to Docker Hub 86 + uses: docker/login-action@v3 87 + with: 88 + username: ${{ secrets.DOCKER_USERNAME }} 89 + password: ${{ secrets.DOCKER_PASSWORD }} 90 + 91 + - name: Login to GitHub Container Registry 92 + uses: docker/login-action@v3 93 + with: 94 + registry: ghcr.io 95 + username: ${{ github.repository_owner }} 96 + password: ${{ secrets.GITHUB_TOKEN }} 97 + 98 + # https://github.com/docker/build-push-action/issues/671#issuecomment-1619353328 99 + # for caching 100 + - name: Build and push by digest 101 + id: build 102 + uses: docker/build-push-action@v6 103 + with: 104 + build-args: | 105 + APP_BUILD_VERSION=${{steps.appversion.outputs.appversion}} 106 + platforms: ${{ matrix.platform }} 107 + labels: ${{ steps.meta.outputs.labels }} 108 + #tags: ${{ steps.meta.outputs.tags }} 109 + outputs: type=image,"name=${{ env.DOCKERHUB_SLUG }},${{ env.GHCR_SLUG }}",push-by-digest=true,name-canonical=true,push=true 110 + #cache-from: type=gha,scope=build-${{ env.PLATFORM_PAIR }} 111 + #cache-to: type=gha,scope=build-${{ env.PLATFORM_PAIR }} 112 + 113 + - name: Export digest 114 + run: | 115 + mkdir -p /tmp/digests 116 + digest="${{ steps.build.outputs.digest }}" 117 + touch "/tmp/digests/${digest#sha256:}" 118 + 119 + - name: Upload digest 120 + uses: actions/upload-artifact@v4 121 + with: 122 + name: digests-${{ env.PLATFORM_PAIR }} 123 + path: /tmp/digests/* 124 + if-no-files-found: error 125 + retention-days: 1 126 + 127 + merge: 128 + runs-on: ubuntu-latest 129 + permissions: 130 + packages: write 131 + contents: read 132 + needs: 133 + - build 134 + steps: 135 + - name: Download digests 136 + uses: actions/download-artifact@v4 137 + with: 138 + path: /tmp/digests 139 + pattern: digests-* 140 + merge-multiple: true 141 + 142 + - name: Set up Docker Buildx 143 + uses: docker/setup-buildx-action@v3 144 + 145 + - name: Extract metadata (tags, labels) for Docker 146 + id: meta 147 + uses: docker/metadata-action@v5 148 + with: 149 + images: | 150 + ${{ env.DOCKERHUB_SLUG }} 151 + ${{ env.GHCR_SLUG }} 152 + # generate Docker tags based on the following events/attributes 153 + # https://github.com/docker/metadata-action/issues/247#issuecomment-1511259674 for NOT is default branch, eventually 154 + tags: | 155 + type=edge 156 + 157 + # maybe re-enable branch-named tags in the futures 158 + #type=ref,event=branch,enable=${{ !endsWith(github.ref, 'master') }} 159 + 160 + # tag non-prelease as latest -- has a higher priority than regular tag so it shows first in registries 161 + type=match,pattern=\d.\d.\d$,priority=901 162 + 163 + # tag all semver (include pre-release) 164 + type=semver,pattern={{version}} 165 + # flavor: | 166 + # latest=false 167 + labels: | 168 + org.opencontainers.image.title=Multi-Scrobbler 169 + org.opencontainers.image.description=Scrobble from many sources to many clients 170 + org.opencontainers.image.vendor=FoxxMD 171 + 172 + - name: Login to Docker Hub 173 + uses: docker/login-action@v3 174 + with: 175 + username: ${{ secrets.DOCKER_USERNAME }} 176 + password: ${{ secrets.DOCKER_PASSWORD }} 177 + 178 + - name: Login to GitHub Container Registry 179 + uses: docker/login-action@v3 180 + with: 181 + registry: ghcr.io 182 + username: ${{ github.repository_owner }} 183 + password: ${{ secrets.GITHUB_TOKEN }} 184 + 185 + - name: Create manifest list and push 186 + working-directory: /tmp/digests 187 + run: | 188 + docker buildx imagetools create $(jq -cr '.tags | map(select(startswith("${{ env.DOCKERHUB_SLUG }}")) | "-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ 189 + $(printf '${{ env.DOCKERHUB_SLUG }}@sha256:%s ' *) 190 + docker buildx imagetools create $(jq -cr '.tags | map(select(startswith("${{ env.GHCR_SLUG }}")) | "-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ 191 + $(printf '${{ env.GHCR_SLUG }}@sha256:%s ' *) 192 + 193 + # - name: Inspect image 194 + # run: | 195 + # docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
+1
.gitignore
··· 133 133 build 134 134 !setupProxy.js 135 135 **/generated-sources.* 136 + .github/act/out