mirror of
				https://github.com/ilri/dspace-statistics-api.git
				synced 2025-10-31 12:51:15 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			889fb2f74a
			...
			acfe87b91a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| acfe87b91a | |||
| bc6d84dda2 | 
							
								
								
									
										21
									
								
								.build.yml
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								.build.yml
									
									
									
									
									
								
							| @@ -1,21 +0,0 @@ | |||||||
| image: archlinux |  | ||||||
| packages: |  | ||||||
|   - python-poetry |  | ||||||
|   - postgresql |  | ||||||
| sources: |  | ||||||
|   - https://git.sr.ht/~alanorth/dspace-statistics-api |  | ||||||
| tasks: |  | ||||||
|   - setup: | |  | ||||||
|       id |  | ||||||
|       psql --version |  | ||||||
|       sudo su - postgres -c "initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'" |  | ||||||
|       sudo systemctl start postgresql |  | ||||||
|       createuser -U postgres dspacestatistics |  | ||||||
|       psql -U postgres -c "ALTER USER dspacestatistics WITH PASSWORD 'dspacestatistics'" |  | ||||||
|       createdb -U postgres -O dspacestatistics --encoding=UNICODE dspacestatistics |  | ||||||
|       cd dspace-statistics-api |  | ||||||
|       psql -U postgres -d dspacestatistics < tests/dspacestatistics.sql |  | ||||||
|       poetry install --no-root |  | ||||||
|   - test: | |  | ||||||
|       cd dspace-statistics-api |  | ||||||
|       poetry run pytest |  | ||||||
							
								
								
									
										61
									
								
								.github/workflows/python-app.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								.github/workflows/python-app.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | |||||||
|  | # This workflow will install Python dependencies, run tests and lint with a single version of Python | ||||||
|  | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||||||
|  |  | ||||||
|  | name: Build and Test | ||||||
|  |  | ||||||
|  | on: ['push', 'pull_request'] | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   build: | ||||||
|  |  | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|  |     services: | ||||||
|  |       database: | ||||||
|  |         image: postgres:10-alpine | ||||||
|  |         env: | ||||||
|  |           # password for postgres user in the Docker container | ||||||
|  |           POSTGRES_PASSWORD: postgres | ||||||
|  |           # default database to create | ||||||
|  |           POSTGRES_DB: dspacestatistics | ||||||
|  |         options: >- | ||||||
|  |           --health-cmd pg_isready | ||||||
|  |           --health-interval 10s | ||||||
|  |           --health-timeout 5s | ||||||
|  |           --health-retries 5 | ||||||
|  |         ports: | ||||||
|  |           - 5432:5432 | ||||||
|  |  | ||||||
|  |     steps: | ||||||
|  |     - uses: actions/checkout@v2 | ||||||
|  |     - name: Set up Python 3.9 | ||||||
|  |       uses: actions/setup-python@v2 | ||||||
|  |       with: | ||||||
|  |         python-version: 3.9 | ||||||
|  |     - name: Install dependencies | ||||||
|  |       run: | | ||||||
|  |         python -m pip install --upgrade pip | ||||||
|  |         pip install flake8 pytest | ||||||
|  |         if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||||||
|  |         if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | ||||||
|  |     - name: Lint with flake8 | ||||||
|  |       run: | | ||||||
|  |         # stop the build if there are Python syntax errors or undefined names | ||||||
|  |         flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||||||
|  |         # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||||||
|  |         flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||||||
|  |     - name: Set up PostgreSQL | ||||||
|  |       run: | | ||||||
|  |         pg_isready -U postgres -d dspacestatistics | ||||||
|  |         createuser -U postgres dspacestatistics | ||||||
|  |         psql -U postgres -c "ALTER USER dspacestatistics WITH PASSWORD 'dspacestatistics'" | ||||||
|  |         psql -U postgres -d dspacestatistics < tests/dspacestatistics.sql | ||||||
|  |       env: | ||||||
|  |         PGHOST: localhost | ||||||
|  |         PGPASSWORD: postgres | ||||||
|  |     - name: Test with pytest | ||||||
|  |       run: | | ||||||
|  |         pytest | ||||||
|  |       env: | ||||||
|  |         PGHOST: localhost | ||||||
|  |         PGPASSWORD: dspacestatistics | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| # DSpace Statistics API [](https://ci.mjanja.ch/alanorth/dspace-statistics-api) [](https://builds.sr.ht/~alanorth/dspace-statistics-api?) | # DSpace Statistics API [](https://ci.mjanja.ch/alanorth/dspace-statistics-api) [](https://github.com/ilri/dspace-statistics-api/actions/workflows/python-app.yml) | ||||||
| DSpace stores item view and download events in a Solr "statistics" core. This information is available for use in the various DSpace user interfaces, but is not exposed externally via any APIs. The DSpace 4/5/6 [REST API](https://wiki.lyrasis.org/display/DSDOC5x/REST+API), for example, only exposes _metadata_ about communities, collections, items, and bitstreams. | DSpace stores item view and download events in a Solr "statistics" core. This information is available for use in the various DSpace user interfaces, but is not exposed externally via any APIs. The DSpace 4/5/6 [REST API](https://wiki.lyrasis.org/display/DSDOC5x/REST+API), for example, only exposes _metadata_ about communities, collections, items, and bitstreams. | ||||||
|  |  | ||||||
| - If your DSpace is version 4 or 5, use [dspace-statistics-api v1.1.1](https://github.com/ilri/dspace-statistics-api/releases/tag/v1.1.1) | - If your DSpace is version 4 or 5, use [dspace-statistics-api v1.1.1](https://github.com/ilri/dspace-statistics-api/releases/tag/v1.1.1) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user