Skip to content

Commit e0a705c

Browse files
Greg BowlerRichard BirkinRichard Birkinrichardbirkin
authored
SLC 1 (#87)
* test: add failing test for multiple uploads * feature: keep track of multiple artists in uploads * tweak: simplify money rounding for now * test: add failing tests and test csv for bandcamp upload * refactor: share csv header functionality * feature: implement bandcamp upload and detection * build: ignore data directory * feature: clean datasets on import * feature: clean null bytes and hidden tracking characters * test: test that bandcamp files are processed correctly * test: a few tests to cover the artist usage aggregation * wip: restructure page using uploaded-files-list tag * wip: style new structure * wip: sort data * wip: new class layout for artist usages * feature: feature complete #51 * test: test for multiple artists * Change titles and styling on homepage * Basic UI styling v1 * Styling for multiple artists * test: rename HTML fields * Create homepage.md * Update homepage.md Headine and Subheading added. * Update homepage.md Additional content writing * design: style tidy up * wip: tidy up upload/statement usage * test: refactor phpunit v10 * test: simplify tests for new codebase * test: full ci tooling * ci: test class dir, not src dir * ci: php 8,2 * ci: wrap php version in quotes? * ci: bump pdepend * ci: use phpmd 2.13.0 * ci: use vendored version * ci: use vendored version * ci: add deployment back in * ci: add deployment back in * content: add missing assets * tweak: client side files * build: bump deps * wip: slc1 * wip: api config * test: upload classes including cargo * test: improve phpmd and phpcs tests * test: update dummy test data * build: update dependencies * wip: cargo product matching * wip: optimise file upload fetch request for large files * feature: lazy load images from spotify * build: apply fix for domtemplate * wip: temporarily disable ci deployment * wip: search spotify by artist * fix: filter product list by user closes #93 * wip: rejig header and file-uploader component * wip: fix spotify search * feature: exit early if there's no matching artwork on spotify * tweak: format search query * tweak: update spotify api usage * tweak: update spotify api usage (album match) * tweak: improve upload process * styling * new styling * loading page with animation and sheen * wip: in memory database insertion * feature: tidy with FilterQuery * feature: set filtered after completion * build: upgrade dependencies * feature: cron script for background processing * feature: loop within php script * feature: move processing back in-line * wip: get rid of debug code * wip: fix sqlite syntax * wip: lazy load - ignore case * build: update dependencies * fix font file naming convention * design: geomanist font * design: privacy policy page container * wip: html in markdown * design: markdown styling tweaks * design: homepage * design: footer zap width * feature: TunecoreUpload * design: homepage copy and images for SLC1 launch * editorial: added contact details to homepage * tweak: delete from database as well as clear file on disk * fix: remove limit * feature: bring back delete-me section * feature: file clear/expire/extend * feature: auto purge * fix: cargo earning * design: font size and 'delete-me' formatting * design: uploads * tweak: style change for old chrome --------- Co-authored-by: Richard Birkin <richardbirkin@iBiff-Pro.lan> Co-authored-by: Richard Birkin <richardbirkin@iBiff-Pro.local> Co-authored-by: richardbirkin <115098450+richardbirkin@users.noreply.github.com> Co-authored-by: rjbirkin <richard@rjbirkin.co.uk>
1 parent c7f830e commit e0a705c

File tree

204 files changed

+7159
-1786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+7159
-1786
lines changed

.github/workflows/ci.yml

Lines changed: 104 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on: [push]
55
jobs:
66
composer:
77
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php: [ 8.2 ]
811

912
steps:
1013
- uses: actions/checkout@v3
@@ -18,7 +21,7 @@ jobs:
1821
- name: Composer install
1922
uses: php-actions/composer@v6
2023
with:
21-
php_version: '8.1'
24+
php_version: ${{ matrix.php }}
2225

2326
- name: Archive build
2427
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./
@@ -31,7 +34,13 @@ jobs:
3134

3235
phpunit:
3336
runs-on: ubuntu-latest
34-
needs: [composer]
37+
needs: [ composer ]
38+
strategy:
39+
matrix:
40+
php: [ 8.2 ]
41+
42+
outputs:
43+
coverage: ${{ steps.store-coverage.outputs.coverage_text }}
3544

3645
steps:
3746
- uses: actions/download-artifact@v3
@@ -44,15 +53,44 @@ jobs:
4453

4554
- name: PHP Unit tests
4655
uses: php-actions/phpunit@v3
56+
env:
57+
XDEBUG_MODE: cover
4758
with:
48-
php_version: '8.1'
59+
php_version: ${{ matrix.php }}
4960
php_extensions: xdebug
50-
configuration: test/phpunit/phpunit.xml
51-
bootstrap: vendor/autoload.php
61+
coverage_text: _coverage/coverage.txt
62+
coverage_clover: _coverage/clover.xml
63+
64+
- name: Store coverage data
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: code-coverage
68+
path: _coverage
69+
70+
coverage:
71+
runs-on: ubuntu-latest
72+
needs: [ phpunit ]
73+
74+
steps:
75+
- uses: actions/checkout@v3
76+
77+
- uses: actions/download-artifact@v3
78+
with:
79+
name: code-coverage
80+
path: _coverage
81+
82+
- name: Output coverage
83+
run: cat "_coverage/coverage.txt"
84+
85+
- name: Upload to Codecov
86+
uses: codecov/codecov-action@v3
5287

5388
phpstan:
5489
runs-on: ubuntu-latest
55-
needs: [composer]
90+
needs: [ composer ]
91+
strategy:
92+
matrix:
93+
php: [ 8.2 ]
5694

5795
steps:
5896
- uses: actions/download-artifact@v3
@@ -66,12 +104,15 @@ jobs:
66104
- name: PHP Static Analysis
67105
uses: php-actions/phpstan@v3
68106
with:
107+
php_version: ${{ matrix.php }}
69108
path: class/
70-
level: 6
71109

72-
behat:
110+
phpmd:
73111
runs-on: ubuntu-latest
74-
needs: [composer]
112+
needs: [ composer ]
113+
strategy:
114+
matrix:
115+
php: [ 8.2 ]
75116

76117
steps:
77118
- uses: actions/download-artifact@v3
@@ -82,17 +123,21 @@ jobs:
82123
- name: Extract build archive
83124
run: tar -xvf /tmp/github-actions/build.tar ./
84125

85-
- name: Local development server
86-
run: mkdir www && php -S 0.0.0.0:8080 -t www vendor/phpgt/webengine/go.php &
87-
88-
- name: Behat tests
89-
uses: php-actions/behat@v1
126+
- name: PHP Mess Detector
127+
uses: php-actions/phpmd@v1
90128
with:
91-
config: test/behat/behat.yml
129+
php_version: ${{ matrix.php }}
130+
vendored_phpmd_path: vendor/bin/phpmd
131+
path: class/
132+
output: text
133+
ruleset: phpmd.xml
92134

93-
dev-deploy:
135+
phpcs:
94136
runs-on: ubuntu-latest
95-
needs: [composer, phpunit, phpstan, behat]
137+
needs: [ composer ]
138+
strategy:
139+
matrix:
140+
php: [ 8.2 ]
96141

97142
steps:
98143
- uses: actions/download-artifact@v3
@@ -103,11 +148,46 @@ jobs:
103148
- name: Extract build archive
104149
run: tar -xvf /tmp/github-actions/build.tar ./
105150

106-
- uses: php-actions/deploy-ssh@master
151+
- name: PHP Code Sniffer
152+
uses: php-actions/phpcs@v1
107153
with:
108-
hostname: deploy-endpoint.dev.trackshift.app
109-
user: deploy
110-
path: /var/www/trackshift
111-
path_owner: www-data.
112-
ssh_key: ${{ secrets.deploy_ssh_key }}
113-
after_command: ./vendor/bin/gt build
154+
php_version: ${{ matrix.php }}
155+
path: class/
156+
standard: phpcs.xml
157+
158+
# dev-deploy:
159+
# runs-on: ubuntu-latest
160+
# needs: [ composer, phpunit, phpstan, phpcs, phpmd ]
161+
#
162+
# steps:
163+
# - uses: actions/download-artifact@v3
164+
# with:
165+
# name: build-artifact
166+
# path: /tmp/github-actions
167+
#
168+
# - name: Extract build archive
169+
# run: tar -xvf /tmp/github-actions/build.tar ./
170+
#
171+
# - uses: php-actions/deploy-ssh@master
172+
# with:
173+
# hostname: deploy-endpoint.dev.trackshift.app
174+
# user: deploy
175+
# path: /var/www/trackshift
176+
# path_owner: www-data.
177+
# ssh_key: ${{ secrets.deploy_ssh_key }}
178+
# after_command: ./vendor/bin/gt build
179+
180+
remove_old_artifacts:
181+
runs-on: ubuntu-latest
182+
183+
steps:
184+
- name: Remove old artifacts for prior workflow runs on this repository
185+
env:
186+
GH_TOKEN: ${{ github.token }}
187+
run: |
188+
gh api "/repos/${{ github.repository }}/actions/artifacts?name=build-artifact" | jq ".artifacts[] | select(.name == \"build-artifact\") | .id" > artifact-id-list.txt
189+
while read id
190+
do
191+
echo -n "Deleting artifact ID $id ... "
192+
gh api --method DELETE /repos/${{ github.repository }}/actions/artifacts/$id && echo "Done"
193+
done <artifact-id-list.txt

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
/vendor/
2-
.phpunit.result.cache
2+
/data/
3+
/ts.db
4+
/config.*.ini
5+
/www/
6+
.DS_Store
7+
access-token.dat
8+
asset/font/.DS_Store
9+
asset/.DS_Store

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
A music royalties data aggregator
22
=================================
33

4-
// TODO: Very short intro to the project and brief description of the codebase.
4+
We make releasing music easier.
55

6-
A tool that helps artists and record labels process and analyse the complex web of payment data from vendors.
6+
We are DIY artists, label people, software developers and music consumers who are building tools to give indies superpowers in the age of big data.
77

8-
Giving indies superpowers in the age of big data.
8+
"Giving indies superpowers in the age of big data."
9+
10+
Dev todo
11+
--------
12+
13+
Notes for Wednesday: the database speedup is immense. From 6 minutes to about 15 seconds.
14+
But there's still more to do, and ideally it should all be done within 1 second.
15+
So, here's how:
16+
17+
- [x] When the file is uploaded, just store it in the Upload table.
18+
- [x] Introduce a new field, Upload.processedUsages
19+
- [x] In a background script, loop over all uploads that are not processed and extract their usages (then mark as processed)
20+
- [ ] Introduce another new field, Usage.processed
21+
- [ ] In another background script, loop over all usages that are unprocessed, finishing the job here.
22+
- [ ] The usage processor needs to match products and artists - rather than doing this individually in a loop, lookup the unique artist/product first, to cache the IDs (or create new ones), then it's possible to insert UsageOfProduct rows on bulk!
23+
- [ ] Then optimise further with a profiler. Ideally, a very large import should be completed before the page has chance to reload.
24+
- [ ] If a spinner is necessary, it should be put onto the three-checkbox page. It's also possible to know how many usages are left to process, so an ACTUAL progress bar is possible.
925

1026
Setup guide
1127
-----------
1228

13-
// TODO: From scratch for Linux, Windows and Mac.
29+
TODO: From scratch for Linux, Windows and Mac.
1430

1531
Running locally
1632
---------------
1733

18-
// TODO.
34+
TODO.
1935

2036
Writing/running tests
2137
---------------------
2238

23-
// TODO.
39+
TODO.

asset/.DS_Store

8 KB
Binary file not shown.

asset/font/.DS_Store

10 KB
Binary file not shown.

asset/font/geomanist/.DS_Store

6 KB
Binary file not shown.
30.9 KB
Binary file not shown.
28.6 KB
Binary file not shown.
30.6 KB
Binary file not shown.
28.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)