From 6829f481b2e7e3589efafe8a58635a7cbae89588 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Thu, 19 Nov 2026 09:39:41 +0100 Subject: [PATCH 1/2] Restore DataQuest CI/CD workflows on dtq-dev-93 On 2026-10-30 the DataQuest CI was stripped from dtq-dev-9-base to prepare it for ufal/dspace-angular#193 (commits b4f55e36bc, f095a11b04, c713e0ab16). dtq-dev-93 was branched after that, so it had no DataQuest CI at all. Restore .github and scripts/sourceversion.py to their state before that cleanup (f4d6bb40c1), and point the Docker build at dtq-dev-93 instead of dtq-dev-9-base. Related: dataquest-dev/dspace-customers#1024 Co-Authored-By: Claude Opus 5.5 --- .github/actions/erase-db/action.yml | 33 +++ .github/actions/import-db/action.yml | 111 +++++++ .github/copilot-instructions.md | 344 ++++++++++++++++++++++ .github/pull_request_template.md | 41 +-- .github/workflows/create_bitstreams.yml | 32 ++ .github/workflows/deploy.yml | 371 ++++++++++++++++++++++++ .github/workflows/docker.yml | 51 ++-- .github/workflows/erase_db.yml | 29 ++ .github/workflows/new_issue_assign.yml | 16 + .github/workflows/new_issue_label.yml | 17 ++ .github/workflows/playwright-tests.yml | 48 +++ .github/workflows/redeploy-weekly.yml | 23 ++ .github/workflows/tag-release.yml | 2 +- .github/workflows/trigger-builds.yml | 29 ++ .github/workflows/trigger-ui-tests.yml | 37 +++ scripts/sourceversion.py | 4 +- 16 files changed, 1137 insertions(+), 51 deletions(-) create mode 100644 .github/actions/erase-db/action.yml create mode 100644 .github/actions/import-db/action.yml create mode 100644 .github/copilot-instructions.md create mode 100644 .github/workflows/create_bitstreams.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/erase_db.yml create mode 100644 .github/workflows/new_issue_assign.yml create mode 100644 .github/workflows/new_issue_label.yml create mode 100644 .github/workflows/playwright-tests.yml create mode 100644 .github/workflows/redeploy-weekly.yml create mode 100644 .github/workflows/trigger-builds.yml create mode 100644 .github/workflows/trigger-ui-tests.yml diff --git a/.github/actions/erase-db/action.yml b/.github/actions/erase-db/action.yml new file mode 100644 index 00000000000..ec0ad2ce435 --- /dev/null +++ b/.github/actions/erase-db/action.yml @@ -0,0 +1,33 @@ +name: 'Erase dspace db' +description: 'CI/CD Erase db' + +inputs: + INSTANCE: + description: 'port suffix' + required: true + type: string + NAME: + description: 'docker compose project name' + required: true + type: string + +runs: + using: "composite" + steps: + + - name: stop and remove containers + shell: bash + env: + INSTANCE: ${{ inputs.INSTANCE }} + run: | + docker stop dspacesolr$INSTANCE dspacedb$INSTANCE dspace$INSTANCE dspace-angular$INSTANCE || true + docker rm dspacesolr$INSTANCE dspacedb$INSTANCE dspace$INSTANCE dspace-angular$INSTANCE || true + + - name: remove volumes + shell: bash + env: + NAME: ${{ inputs.NAME }} + run: | + echo "Removing volumes for $(docker volume ls --filter name="${NAME}_" -q)" + docker volume rm $(docker volume ls --filter name="${NAME}_" -q) || true + diff --git a/.github/actions/import-db/action.yml b/.github/actions/import-db/action.yml new file mode 100644 index 00000000000..3897dcad688 --- /dev/null +++ b/.github/actions/import-db/action.yml @@ -0,0 +1,111 @@ +name: 'Import dspace db' +description: 'CI/CD import db' + +inputs: + DATADIR: + description: 'data dir with dump, icons' + required: true + type: string + INSTANCE: + description: 'port suffix' + required: true + type: string + ASSETSTORE: + description: 'location of assetstore folder' + required: false + type: string + ADMIN_PASSWORD: + description: 'Admin password for DSpace' + required: true + type: string + LOGDIR: + description: 'Directory for log files' + required: false + type: string + default: '' + +runs: + using: "composite" + steps: + + - name: info + shell: bash + run: | + docker ps -a + + - uses: actions/checkout@v4 + with: + repository: dataquest-dev/dspace-import-clarin + ref: 'main' + submodules: 'recursive' + path: 'dspace-import-clarin' + + + - name: stop and remove containers + id: import + shell: bash + working-directory: dspace-import-clarin/scripts + env: + DATADIR: ${{ inputs.DATADIR }} + DB5PORT: 15432 + DB5NAME: dspace-import-db5 + DB7PORT: 543${{ inputs.INSTANCE }} + BEURL: http://dev-5.pc:8${{ inputs.INSTANCE }}/repository/server/api + BEUSERNAME: dspace.admin.dev@dataquest.sk + BEUSERPASSWORD: ${{ inputs.ADMIN_PASSWORD }} + run: | + docker stop $DB5NAME || true + echo "=====" + echo Starting import DB + # create otherwise it will be created with root owner + cid=$(docker run -d --rm --name $DB5NAME -v $(pwd):/dq/scripts -v $DATADIR/dump:/dq/dump -p 127.0.0.1:$DB5PORT:5432 -e POSTGRES_DB=empty -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=dspace postgres /bin/bash -c "cd /dq/scripts && ./init.dspacedb5.sh") + echo "cid=$cid" >> $GITHUB_OUTPUT + sleep 60 + # copy assetstore + echo Preparing assetstore + if [[ -z ${{ inputs.ASSETSTORE }} ]]; then + echo Location of assetstore folder is empty. Not copping assetstore + else + docker cp ${{ inputs.ASSETSTORE }} dspace${{ inputs.INSTANCE }}:/dspace/ + docker exec -u root dspace${{ inputs.INSTANCE }} chown -R dspace:dspace /dspace/assetstore + fi + echo "=====" + cd ../ + pip install -r requirements.txt || true + echo "=====" + cd ./src + # cleanup resume + rm __temp/resume/*.json || true + # arguments of the script + # required + echo "=====" + # Generate the current timestamp for the log filename + timestamp=$(date +"%y%m%d%H%M") + log_file_timestamp="${{ inputs.LOGDIR }}python.${timestamp}.log" + echo $log_file_timestamp + mkdir ../__logs + # Continuously append to the log file $log_file_timestamp. Start appending when the first file is added to the __logs folder. + inotifywait -m -e create --format "%w%f" ../__logs/ | while IFS= read -r file; do tail -F --retry "$file" >> "$log_file_timestamp" 2>/dev/null & done & + echo "=====" + args=( + --resume=false + --config=backend.endpoint=$BEURL + --config=backend.user=$BEUSERNAME + --config=backend.password=$BEUSERPASSWORD + --config=db_dspace_7.port=$DB7PORT + --config=db_dspace_5.port=$DB5PORT + --config=db_utilities_5.port=$DB5PORT + --config=input.datadir=$DATADIR/data/ + --config=input.icondir=$DATADIR/icon/ + ) + # Add --resume argument if inputs.ASSETSTORE is defined + if [ -n "${{ inputs.ASSETSTORE }}" ]; then + args+=(--assetstore=${{ inputs.ASSETSTORE }}) + fi + python3 repo_import.py "${args[@]}" + - name: cleanup + shell: bash + run: | + docker stop ${{ steps.import.outputs.cid }} || true + if: ${{ always() }} + diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000000..c0735383379 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,344 @@ +# GitHub Copilot Instructions for dspace-angular + +## Project Overview + +**dspace-angular** is the Angular-based frontend UI for DSpace 7, a turnkey digital repository application. This is a fork customized for [clarin-dspace](https://github.com/ufal/clarin-dspace/tree/clarin-v7), built with Angular 15, TypeScript 4.8, and Angular Universal for server-side rendering (SSR). + +- **Size**: ~2,800 TypeScript files, 813 components, 805 test files +- **Framework**: Angular 15 with Angular Universal (SSR) +- **Language**: TypeScript 4.8 +- **Package Manager**: Yarn 1.x (NOT npm) +- **Build Tool**: Angular CLI with custom webpack config +- **Testing**: Jasmine/Karma (unit), Cypress (e2e) +- **Target Runtimes**: Node.js 16.x or 18.x +- **Main Branch**: `clarin-v7` + +## Critical Build Requirements + +### Node Version Requirements +**ALWAYS use Node.js 16.x or 18.x**. Node 20+ is NOT compatible due to dependency constraints (eslint-plugin-jsdoc requires Node 14-19). + +```bash +# If using nvm (RECOMMENDED): +nvm install 18 +nvm use 18 +``` + +### Environment Setup (REQUIRED BEFORE ANY BUILD) + +1. **Always install dependencies first**: + ```bash + yarn install --frozen-lockfile + ``` + - Use `--frozen-lockfile` to ensure consistent versions + - If Cypress download fails due to network restrictions, use: `CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile` + +2. **Never use npm** - this project uses Yarn 1.x exclusively. Package manager commands: + - Add dependency: `yarn add ` + - Remove dependency: `yarn remove ` + - Upgrade dependency: `yarn upgrade ` + +## Build & Validation Commands + +### Standard Workflow (ALWAYS run in this order) +```bash +# 1. Install dependencies (required after any branch switch or pull) +yarn install --frozen-lockfile + +# 2. Lint the code (MUST pass - ~76 seconds) +yarn run lint --quiet + +# 3. Check for circular dependencies (MUST pass - ~34 seconds) +yarn run check-circ-deps + +# 4. Build for production (~6.5 minutes) +yarn run build:prod + +# 5. Run unit tests (~3.5 minutes, 4801 tests) +yarn run test:headless +``` + +### Alternative Commands +- **Development server**: `yarn run start:dev` (localhost:4000) +- **Production server**: `yarn start` (builds then runs with SSR) +- **Build only**: `yarn run build:prod` +- **Unit tests with watch**: `yarn run test:watch` +- **E2E tests**: `yarn run e2e` (requires running DSpace REST backend) +- **Clean everything**: `yarn run clean` (removes node_modules, requires reinstall) +- **Clean build artifacts**: `yarn run clean:prod` + +### Build Time Expectations +- Lint: ~76 seconds +- Circular dependency check: ~34 seconds +- Production build: ~6.5 minutes (390+ seconds) +- Unit tests: ~3.5 minutes (212 seconds), 4801 tests +- Full CI pipeline: ~15-20 minutes + +### Common Build Issues & Solutions + +**Issue**: Node version incompatibility +- **Error**: `The engine "node" is incompatible with this module` +- **Solution**: Switch to Node 16.x or 18.x using nvm + +**Issue**: Cypress installation failure +- **Error**: `The Cypress App could not be downloaded` +- **Solution**: Use `CYPRESS_INSTALL_BINARY=0` flag during yarn install + +**Issue**: Out of memory during build +- **Solution**: The CI sets `NODE_OPTIONS='--max-old-space-size=4096'` + +**Issue**: Merge conflicts in yarn.lock +- **Solution**: + ```bash + git checkout --theirs yarn.lock + yarn install + git add yarn.lock + git commit + ``` + +## Code Quality Requirements (CI CHECKS) + +All pull requests MUST pass these checks: + +1. **ESLint validation**: `yarn run lint --quiet` (MUST pass) +2. **No circular dependencies**: `yarn run check-circ-deps` (MUST pass) +3. **TypeDoc comments**: All new/modified public methods and classes require JSDoc comments +4. **Unit tests**: All tests must pass, new features require new tests +5. **Code coverage**: Currently ~77% statements, 74% functions +6. **Build success**: Production build must complete without errors + +### Linting Configuration +- Config file: `.eslintrc.json` +- Rules: TypeScript strict mode, Angular style guide +- Auto-fix: `yarn run lint-fix` (use cautiously) + +## Project Structure + +### Root Directory Files +``` +angular.json # Angular CLI configuration +karma.conf.js # Karma test runner config +cypress.config.ts # Cypress e2e test config +package.json # Dependencies & scripts +tsconfig.json # TypeScript base config +.eslintrc.json # ESLint rules +nodemon.json # Development server hot reload +server.ts # Express server for SSR +``` + +### Key Directories +``` +/config # App configuration (config.yml) +/src/app # Main application code (components, services, modules) +/src/assets # Static files (i18n, images, fonts) +/src/config # TypeScript config interfaces +/src/environments # Environment-specific configs +/src/themes # UI themes (dspace, custom) +/cypress/e2e # E2E integration tests +/webpack # Custom webpack configurations +/docker # Docker compose files for dev/test +/scripts # Build and utility scripts +/docs # Documentation (Configuration.md) +``` + +### Source Code Organization +- **Components**: `/src/app//.component.ts` +- **Services**: `/src/app/core/services/` +- **Models**: `/src/app/core/shared/` +- **Tests**: Co-located with source files (`.spec.ts`) +- **Themes**: `/src/themes/dspace/` and `/src/themes/custom/` + +### Configuration Files + +**Application Configuration**: +- Default: `config/config.yml` +- Environment-specific: `config/config.(dev|prod).yml` +- Runtime: Can be overridden via environment variables (prefix: `DSPACE_`) + +**Environment Variables** (for testing/CI): +```bash +DSPACE_REST_HOST=localhost +DSPACE_REST_PORT=8080 +DSPACE_REST_NAMESPACE=/server +DSPACE_REST_SSL=false +DSPACE_UI_HOST=localhost +DSPACE_UI_PORT=4000 +``` + +## Testing + +### Unit Tests (Jasmine/Karma) +- **Location**: `src/**/*.spec.ts` (co-located with source) +- **Run**: `yarn run test:headless` (CI mode) or `yarn test` (watch mode) +- **Run single test**: `yarn run test:headless --include='**/path/to/test.spec.ts'` + - Use glob patterns relative to workspace root + - Example: `yarn run test:headless --include='**/date-picker/date-picker.component.spec.ts'` +- **Config**: `karma.conf.js` +- **Coverage**: Generated in `/coverage/dspace-angular/` +- **Expectations**: ~4801 tests, ~77% coverage, ~3.5 minute runtime + +### E2E Tests (Cypress) +- **Location**: `/cypress/e2e/**/*.spec.ts` +- **Run**: `yarn run e2e` (requires backend at localhost:8080) +- **Config**: `cypress.config.ts` +- **Prerequisites**: + - DSpace REST API running (see docker/README.md) + - Test data loaded (Entities dataset) +- **Browser**: Chrome by default + +### Test Best Practices +- Always run unit tests before creating a PR +- Co-locate test files with source code +- Use existing test patterns for consistency +- E2E tests require backend - document this in PRs + +## GitHub Actions CI Workflow + +**Main workflow**: `.github/workflows/build.yml` + +CI runs on: +- Push to `clarin-v7` or `customer/*` branches +- All pull requests +- Daily schedule +- Manual workflow dispatch + +**CI Steps** (matrix: Node 16.x, 18.x): +1. Checkout code +2. Install Node.js (specified version) +3. Install Chrome (for e2e tests) +4. Cache Yarn dependencies +5. Install dependencies: `yarn install --frozen-lockfile` +6. Lint: `yarn run lint --quiet` +7. Check circular deps: `yarn run check-circ-deps` +8. Build: `yarn run build:prod` +9. Unit tests: `yarn run test:headless` +10. Start Docker backend (for e2e) +11. E2E tests with Cypress +12. Verify SSR rendering + +**Artifacts**: Coverage reports, e2e videos/screenshots (on failure) + +## Docker Support + +Docker configurations are in `/docker/` directory (see docker/README.md): + +- `docker-compose.yml`: Start Angular UI from current branch +- `docker-compose-rest.yml`: Start DSpace REST API backend +- `docker-compose-ci.yml`: CI testing configuration +- `cli.yml`: DSpace CLI commands +- `cli.assetstore.yml`: Load test data + +**Note**: Docker images are for development/testing only, NOT production-ready. + +## Architecture & Patterns + +### Angular Universal (SSR) +- Server entry: `src/main.server.ts` +- Browser entry: `src/main.browser.ts` +- Express server: `server.ts` +- SSR is REQUIRED - all changes must support SSR + +### State Management +- Uses NgRx for state management +- Store configuration: `/src/app/store/` + +### Theming +- Themeable components in `/src/themes/` +- Base theme: `dspace` +- Custom theme: `custom` + +### Key Dependencies +- Angular 15.2.8 +- TypeScript 4.8.4 +- Bootstrap 4.6.x +- NgRx 15.4.x +- RxJS 7.8.x + +## Making Code Changes + +### Before Starting +1. Switch to Node 16 or 18: `nvm use 18` +2. Install dependencies: `yarn install --frozen-lockfile` +3. Run linter baseline: `yarn run lint --quiet` +4. Run tests baseline: `yarn run test:headless` + +### During Development +1. Make minimal, focused changes +2. Add TypeDoc comments for public APIs +3. Keep changes SSR-compatible +4. Run lint frequently: `yarn run lint --quiet` +5. Add/update tests as needed + +### Before Committing +1. Lint: `yarn run lint --quiet` (MUST pass) +2. Check circular deps: `yarn run check-circ-deps` (MUST pass) +3. Build: `yarn run build:prod` (MUST succeed) +4. Test: `yarn run test:headless` (MUST pass) +5. Manual smoke test if UI changes made + +### Pull Request Requirements +- PR must pass all CI checks +- Include description of changes +- Link to related issues +- Update documentation if needed +- Add tests for new functionality +- Follow Angular style guide + +## Common Patterns & Conventions + +### File Naming +- Components: `*.component.ts` +- Services: `*.service.ts` +- Models: `*.model.ts` +- Tests: `*.spec.ts` +- Module: `*.module.ts` + +### Code Style +- Prefix for components: `ds-` (e.g., ``) +- TypeScript strict mode enabled +- Single quote for strings +- 2-space indentation +- No trailing spaces +- End files with newline + +### Import Conventions +- Avoid barrel imports where possible +- Import from specific files for better tree-shaking +- Use lodash method imports: `import get from 'lodash/get'` + +## Troubleshooting Checklist + +If builds/tests fail: + +1. **Check Node version**: `node --version` (should be 16.x or 18.x) +2. **Clean install**: `yarn run clean && yarn install --frozen-lockfile` +3. **Clear Angular cache**: `yarn run clean:cli` +4. **Check for merge conflicts** in yarn.lock +5. **Verify environment variables** if configuration seems wrong +6. **Check disk space** - builds create large artifacts +7. **Increase Node memory** if OOM: `export NODE_OPTIONS='--max-old-space-size=4096'` + +## Additional Resources + +- **Documentation**: https://wiki.lyrasis.org/display/DSDOC7x/ +- **REST API Contract**: https://github.com/DSpace/RestContract +- **Contributing Guide**: CONTRIBUTING.md +- **Configuration Guide**: docs/Configuration.md +- **Docker Guide**: docker/README.md + +## Important Notes + +- **ALWAYS** use Yarn, never npm +- **ALWAYS** use Node 16 or 18, not 20+ +- **ALWAYS** run `yarn install --frozen-lockfile` after branch changes +- **ALWAYS** validate changes with lint, build, and test before PR +- This project uses Angular Universal - all code must be SSR-compatible +- Default backend: Demo DSpace REST API (no local backend required for basic testing) +- Branch naming: Feature branches should target `clarin-v7` + +## Trust These Instructions + +These instructions have been validated by running all commands successfully. If you encounter discrepancies or errors: +1. First verify you're using Node 16 or 18 +2. Ensure dependencies are installed: `yarn install --frozen-lockfile` +3. Only search for additional information if these instructions are incomplete or proven incorrect diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a60a7a8591d..8efe0f8cf86 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,33 +1,16 @@ -## References -_Add references/links to any related issues or PRs. These may include:_ -* Fixes #issue-number (if this fixes an issue ticket) -* Requires DSpace/DSpace#pr-number (if a REST API PR is required to test this) +## Problem description -## Description -Short summary of changes (1-2 sentences). +## Analysis +(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.) +## Problems +(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.) -## Instructions for Reviewers -Please add a more detailed description of the changes made by your PR. At a minimum, providing a bulleted list of changes in your PR is helpful to reviewers. +### Sync verification +If en.json5 or cs.json5 translation files were updated: +- [ ] Run `yarn run sync-i18n -t src/assets/i18n/cs.json5 -i` to synchronize messages, and changes are included in this PR. -List of changes in this PR: -* First, ... -* Second, ... +### Manual Testing (if applicable) +- [ ] Added to [testing scenarios](https://github.com/dataquest-dev/dspace-customers/issues/55) -**Include guidance for how to test or review your PR.** This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes. - -## Checklist -_This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome). -However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!_ - -- [ ] My PR is **created against the `main` branch** of code (unless it is a backport or is fixing an issue specific to an older branch). -- [ ] My PR is **small in size** (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible. -- [ ] My PR **passes [ESLint](https://eslint.org/)** validation using `npm run lint` -- [ ] My PR **doesn't introduce circular dependencies** (verified via `npm run check-circ-deps`) -- [ ] My PR **includes [TypeDoc](https://typedoc.org/) comments** for _all new (or modified) public methods and classes_. It also includes TypeDoc for large or complex private methods. -- [ ] My PR **passes all specs/tests and includes new/updated specs or tests** based on the [Code Testing Guide](https://wiki.lyrasis.org/display/DSPACE/Code+Testing+Guide). -- [ ] My PR **aligns with [Accessibility guidelines](https://wiki.lyrasis.org/display/DSDOC9x/Accessibility)** if it makes changes to the user interface. -- [ ] My PR **uses i18n (internationalization) keys** instead of hardcoded English text, to allow for translations. -- [ ] My PR **includes details on how to test it**. I've provided clear instructions to reviewers on how to successfully test this fix or feature. -- [ ] If my PR includes new libraries/dependencies (in `package.json`), I've made sure their licenses align with the [DSpace BSD License](https://github.com/DSpace/DSpace/blob/main/LICENSE) based on the [Licensing of Contributions](https://wiki.lyrasis.org/display/DSPACE/Code+Contribution+Guidelines#CodeContributionGuidelines-LicensingofContributions) documentation. -- [ ] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself. -- [ ] If my PR fixes an issue ticket, I've [linked them together](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue). +### Copilot review +- [ ] Requested review from Copilot \ No newline at end of file diff --git a/.github/workflows/create_bitstreams.yml b/.github/workflows/create_bitstreams.yml new file mode 100644 index 00000000000..793bb806445 --- /dev/null +++ b/.github/workflows/create_bitstreams.yml @@ -0,0 +1,32 @@ +name: create_bitstreams - import test files + +on: + workflow_dispatch: + inputs: + INSTANCE: + required: true + default: '8' + type: choice + options: + - '2' + - '5' + - '6' + - '8' + +jobs: + import-specific-bitstreams: + runs-on: dspace-dep-1 + env: + DSPACE_REST_API: http://dev-5.pc:8${{ github.event.inputs.INSTANCE }}/server/api + steps: + - uses: actions/checkout@v4 + with: + repository: dataquest-dev/dspace-rest-test + ref: master + submodules: 'recursive' + + - name: install requirements and run import + run: | + pip install -q -r requirements.txt + cd tests/integration + python3 create_bitstreams.py diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..35f82265564 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,371 @@ +# DSpace Docker deploy on dataquest servers +name: Deploy DSpace + +on: + workflow_call: + inputs: + DEV_MACHINE: + required: false + type: string + default: 'dev-6' + INSTANCE: + required: false + type: string + default: '8603' + IMPORT: + required: false + default: false + type: boolean + ERASE_DB: + required: false + default: false + type: boolean + DUMP_PATH: + required: false + type: string + default: '/opt/dspace-envs/8603/dump/dspace_dev5_dump_26.07.16.sql' + ASSETSTORE_PATH: + required: false + type: string + default: '/opt/dspace-envs/8603/assetstore' + + workflow_dispatch: + inputs: + INSTANCE: + required: true + default: '8603' + type: choice + options: + - '8603' + IMPORT: + required: true + default: true + type: boolean + ERASE_DB: + required: false + default: false + type: boolean + DEV_MACHINE: + required: false + type: string + default: 'dev-6' + DUMP_PATH: + description: 'Absolute path of the SQL dump ON THE DEV MACHINE (used only when IMPORT is checked)' + required: false + type: string + default: '/opt/dspace-envs/8603/dump/dspace_dev5_dump_26.07.16.sql' + ASSETSTORE_PATH: + description: 'Absolute path of the assetstore directory ON THE DEV MACHINE' + required: false + type: string + default: '/opt/dspace-envs/8603/assetstore' + PROBE_ONLY: + description: 'Only report the state of the target machine; deploy and import nothing' + required: false + default: false + type: boolean + +jobs: + # Read-only report of the machine we are about to touch. Runs first so that a + # misconfigured target is visible in the log even when the deploy then fails. + probe: + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 + timeout-minutes: 10 + env: + INSTANCE: ${{inputs.INSTANCE}} + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env + steps: + - uses: actions/checkout@v6 + + - name: config dir + dump + run: | + echo "===== $CONFIG_PATH" + ls -la "$CONFIG_PATH/" || echo "MISSING: $CONFIG_PATH" + echo "===== $CONFIG_PATH/dump" + ls -la "$CONFIG_PATH/dump/" || echo "MISSING: $CONFIG_PATH/dump" + echo "===== dump referenced by DUMP_PATH input" + ls -la "${{ inputs.DUMP_PATH }}" || echo "MISSING dump: ${{ inputs.DUMP_PATH }}" + echo "===== port-ish keys from .env (values shown; these are ports, not secrets)" + grep -E '^(PG_PORT|SOLR_PORT|DSPACE_PORT|DSPACE_FE_PORT|DSPACE_REST_PORT|DSPACE_DOCKER_REST_PORT|DSPACE_VER|DSPACE_HOST)=' "$ENVFILE" || echo "no port keys found" + + - name: who owns the host ports + run: | + echo "===== all dspace-ish containers and their published ports" + docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -Ei 'dspace|postgres|solr' || echo "none" + echo "===== anything publishing host port 5432" + docker ps --format '{{.Names}}\t{{.Ports}}' | grep -E '(^|[^0-9])5432->' || echo "nothing publishes 5432" + echo "===== host listeners on 5432" + (ss -lntp 2>/dev/null || netstat -lntp 2>/dev/null) | grep -E ':5432' || echo "no listener on 5432 (or no permission to see it)" + + - name: resolved compose ports for this instance + run: | + echo "===== resolved ports for this instance (this is what deploy uses)" + docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + -f "$CONFIG_PATH/docker-compose-rest.yml" -f "$CONFIG_PATH/docker-compose.yml" \ + config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -40 \ + || echo "compose config failed" + # The overlay must REPLACE the fixed ports the vanilla files publish, not add to + # them: compose merges `ports` lists across -f files. If a fixed port survives the + # merge above, the overlay is missing `ports: !override` and this instance will + # fight whichever one already owns it on the host. + echo "===== vanilla files alone, for comparison (the fixed ports the overlay must replace)" + docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + config 2>&1 | grep -nE '^ [a-z-]+:|container_name:|published:|^\s+ports:' | head -30 \ + || echo "compose config failed" + echo "===== verdict" + if docker compose --env-file "$ENVFILE" -p dspace-$INSTANCE \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + -f "$CONFIG_PATH/docker-compose-rest.yml" -f "$CONFIG_PATH/docker-compose.yml" \ + config 2>/dev/null | grep -qE 'published: "(5432|8080|8983|4000|9876)"'; then + echo " WARNING: overlay still inherits vanilla fixed ports." + echo " Add 'ports: !override' to $CONFIG_PATH/docker-compose.yml and docker-compose-rest.yml," + echo " otherwise the deploy will fail with 'port is already allocated'." + else + echo " OK: only instance-scoped ports are published" + fi + + - name: postgres inside the instance db container + run: | + docker exec dspacedb$INSTANCE sh -c 'echo "PGPORT=$PGPORT"; pg_isready -U dspace; psql -U dspace -d postgres -tAc "SHOW port;" 2>/dev/null' || echo "could not probe dspacedb$INSTANCE" + + # Does the instance actually hold the imported data and serve it? A green import + # job only proves the commands exited 0. + - name: data + service health + run: | + # DSpace keeps Flyway's history in "schema_version", not Flyway's default + # "flyway_schema_history" -- see DatabaseUtils.FLYWAY_TABLE. + echo "===== last applied migrations (schema_version)" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select version, script, success from schema_version order by installed_rank desc limit 5;" \ + 2>&1 || echo "could not read schema_version" + # What `database repair` did to the imported CLARIN history. repair only rewrites + # this bookkeeping table -- it never touches user tables or their rows. + echo "===== CLARIN 7.6 entries / anything repair marked deleted" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select installed_rank||' | '||version||' | type='||type||' | success='||success||' | '||script from schema_version where version like '7.6%' or type='DELETE' order by installed_rank desc limit 12;" \ + 2>&1 || echo "could not read schema_version" + echo "===== CLARIN-specific tables still present after repair" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select 'public tables total='||count(*) from information_schema.tables where table_schema='public';" 2>&1 || true + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select string_agg(table_name, ', ') from information_schema.tables where table_schema='public' and (table_name like '%clarin%' or table_name like '%license%');" 2>&1 || true + echo "===== row counts" + docker exec dspacedb$INSTANCE psql -U dspace -d dspace -tAc \ + "select 'item='||(select count(*) from item) || ' bitstream='||(select count(*) from bitstream) || ' collection='||(select count(*) from collection) || ' community='||(select count(*) from community) || ' eperson='||(select count(*) from eperson);" \ + 2>&1 || echo "could not count rows" + echo "===== dspace version" + docker exec dspace$INSTANCE /bin/bash -c "cd /dspace/bin && ./dspace version" 2>&1 | head -5 || echo "dspace version failed" + echo "===== REST API on the instance" + curl -s -o /dev/null -w " repository/server/api -> HTTP %{http_code}\n" "http://localhost:${DSPACE_DOCKER_REST_PORT:-6603}/repository/server/api" || true + curl -s "http://localhost:${DSPACE_DOCKER_REST_PORT:-6603}/repository/server/api/core/items?size=1" 2>/dev/null | head -c 300 || true + echo "" + + deploy-8603: + if: (inputs.INSTANCE == '*' || inputs.INSTANCE == '8603') && !inputs.PROBE_ONLY + needs: probe + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 + timeout-minutes: 60 + env: + INSTANCE: '8603' + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + ENVFILE: /opt/dspace-envs/${{inputs.INSTANCE}}/.env + steps: + - uses: actions/checkout@v6 + + - uses: ./.github/actions/erase-db + if: inputs.ERASE_DB + with: + INSTANCE: ${{ env.INSTANCE }} + NAME: dspace-${{ env.INSTANCE }} + + - name: Set start.sh as executable + run: chmod +x build-scripts/run/start.sh + + - name: deploy to ${{inputs.DEV_MACHINE}} + working-directory: build-scripts/run/ + env: + ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + USER_PASSWORD: ${{ secrets.DSPACE_USER_PASSWORD }} + INSTANCE_OVERLAY: ${{ env.CONFIG_PATH }} + run: | + ./start.sh dspace-$INSTANCE + cd ../.. + docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f $CONFIG_PATH/docker-compose-rest.yml -f $CONFIG_PATH/docker-compose.yml up -d --no-build --remove-orphans + + import-8603: + runs-on: dspace-${{inputs.DEV_MACHINE}}-dep-1 + if: inputs.IMPORT + timeout-minutes: 900 + needs: deploy-8603 + env: + INSTANCE: ${{inputs.INSTANCE}} + CONFIG_PATH: /opt/dspace-envs/${{inputs.INSTANCE}} + DUMP_PATH: ${{inputs.DUMP_PATH}} + ASSETSTORE_PATH: ${{inputs.ASSETSTORE_PATH}} + ADMIN_PASSWORD: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + steps: + - uses: actions/checkout@v6 + + - name: vanilla import + run: | + export DNAME=dspace${INSTANCE} + export DDBNAME=dspacedb${INSTANCE} + + if [ ! -f "$DUMP_PATH" ]; then + echo "::error::Dump not found on ${{inputs.DEV_MACHINE}}: $DUMP_PATH" + exit 1 + fi + echo "Importing dump: $DUMP_PATH ($(du -h "$DUMP_PATH" | cut -f1))" + + # Stop the app so it cannot hold connections to the database we are about to drop. + docker stop $DNAME || true + + echo "=====" + docker cp "$DUMP_PATH" $DDBNAME:/tmp/dump.sql + + # Recreate the database from scratch and load the vanilla dump. + docker exec $DDBNAME /bin/bash -c " + dropdb -U dspace dspace || true && + createdb -U dspace --owner=dspace --encoding=UNICODE dspace && + psql -U dspace -d dspace -f /tmp/dump.sql + " + echo "=====" + docker exec $DDBNAME /bin/bash -c "rm -f /tmp/dump.sql" || true + + - name: run database migration + run: | + export DNAME=dspace${INSTANCE} + export ENVFILE=$CONFIG_PATH/.env + export OVERLAY=$CONFIG_PATH + + # --------------------------------------------------------------- + # Why a one-off `docker compose run` instead of `docker exec $DNAME migrate`: + # The dspace entrypoint auto-runs `dspace database migrate` (WITHOUT `ignored`) + # and then starts the REST webapp. On a freshly imported dump the + # "Ignored" XMLWorkflow migrations are NOT applied, so the webapp boots against + # an un-migrated DB, crashes, and (with the restart policy) the container + # restarts. That restart SIGKILLs any `docker exec` running inside it -> the + # migration dies with exit 137. So we stop the app and run the migration as a + # one-off compose container (overridden entrypoint = migrate only, no webapp, + # no restart policy), using the same compose files/env as the deploy step. + # --------------------------------------------------------------- + + echo "Stopping app container so its restart loop can't kill the migration..." + docker stop $DNAME || true + + # `database repair` before `migrate`: the dump comes from a CLARIN 7.6 instance, + # so its flyway_schema_history lists CLARIN-specific migrations that do not exist + # in this vanilla v9 tree. Flyway validation then refuses to migrate at all: + # "Detected applied migration not resolved locally: 7.6.2026.06.01." + # repair marks those unresolvable entries as deleted, which is exactly what we want + # when migrating an old CLARIN dump onto vanilla v9 -- their DDL is already in the + # dump, we just do not carry the migration scripts any more. + echo "Running one-off DB repair + migration via docker compose..." + docker compose --env-file $ENVFILE -p dspace-${INSTANCE} \ + -f docker/docker-compose.yml -f docker/docker-compose-rest.yml \ + \ + -f $OVERLAY/docker-compose-rest.yml -f $OVERLAY/docker-compose.yml \ + run --rm --no-deps --entrypoint /bin/bash dspace \ + -c "while (!/dev/null 2>&1; do sleep 1; done; cd /dspace/bin && ./dspace database repair && ./dspace database migrate ignored" + + echo "Migration done. Starting app container (entrypoint migrate is now a no-op)..." + docker start $DNAME + + echo "Waiting for DSpace to be ready..." + sleep 10 + + - name: restart dspace container + run: | + export DNAME=dspace${INSTANCE} + echo "Restarting DSpace container..." + docker restart $DNAME + sleep 60 + + - name: copy assetstore + run: | + export DNAME=dspace${INSTANCE} + + # No `chown -R dspace:dspace` (unlike v7): the v9 runtime image has no `dspace` + # user, the webapp runs as root, and that chown fails with "invalid user". + echo "Preparing assetstore" + if [ -z "$ASSETSTORE_PATH" ]; then + echo "Assetstore path is empty. Not copying assetstore." + else + docker cp "$ASSETSTORE_PATH" $DNAME:/dspace/ + fi + + - name: create administrator + run: | + export DNAME=dspace${INSTANCE} + echo "Creating DSpace administrator..." + docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace create-administrator -e dspace.admin.dev@dataquest.sk -f admin -l user -p \"${ADMIN_PASSWORD}\" -c en" + + - name: rebuild discovery index and run oai import + run: | + export DNAME=dspace${INSTANCE} + echo "Rebuilding discovery index..." + docker exec $DNAME /bin/bash -c "/dspace/bin/dspace index-discovery -b" + + echo "Running OAI import..." + docker exec $DNAME /bin/bash -c "/dspace/bin/dspace oai import -c" + + playwright-after-deploy8603: + needs: deploy-8603 + if: '!inputs.IMPORT' + uses: ./.github/workflows/playwright-tests.yml + secrets: inherit + + rest-tests-after-deploy8603: + runs-on: ubuntu-latest + needs: playwright-after-deploy8603 + if: '!inputs.IMPORT' + timeout-minutes: 120 + env: + GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} + REPO: dataquest-dev/dspace-rest-test + WORKFLOW: run_unittests.yml + steps: + - name: run rest-tests + run: | + OUTPUT=$(gh workflow run "$WORKFLOW" \ + --repo "$REPO" \ + --ref master \ + -f CUSTOMER="${{ github.ref_name }}" \ + -f URL="http://dev-6.pc:8603/repository/server/api" 2>&1) + + RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') + + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" + gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status + + playwright-after-import8603: + needs: import-8603 + if: inputs.IMPORT + uses: ./.github/workflows/playwright-tests.yml + secrets: inherit + + rest-tests-after-import8603: + runs-on: ubuntu-latest + needs: playwright-after-import8603 + if: inputs.IMPORT + timeout-minutes: 120 + env: + GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} + REPO: dataquest-dev/dspace-rest-test + WORKFLOW: run_unittests.yml + steps: + - name: run rest-tests + run: | + OUTPUT=$(gh workflow run "$WORKFLOW" \ + --repo "$REPO" \ + --ref master \ + -f CUSTOMER="${{ github.ref_name }}" \ + -f URL="http://dev-6.pc:8603/repository/server/api" 2>&1) + + RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') + + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" + gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c9514fc885d..0faf684fbfa 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,36 +1,37 @@ # DSpace Docker image build for hub.docker.com name: Docker images -# Run this Build for all pushes to 'clarin-v9'. +# Run this Build for all pushes to 'dtq-dev-93' (the CLARIN/DSpace 9 base branch). # Also run for PRs to ensure PR doesn't break Docker build process (PRs build, but do not push). -# NOTE: uses "reusable-docker-build.yml" in ufal/clarin-dspace to actually build each of the Docker images -# https://github.com/ufal/clarin-dspace/blob/clarin-v9/.github/workflows/reusable-docker-build.yml +# NOTE: uses "reusable-docker-build.yml" from the 'dtq-dev' branch of dataquest-dev/DSpace to actually +# build each of the Docker images. That is the same reusable workflow which builds our 'dtq-dev' and +# 'customer/*' images, and it pushes straight to hub.docker.com/u/dataquest. +# https://github.com/dataquest-dev/DSpace/blob/dtq-dev/.github/workflows/reusable-docker-build.yml on: push: branches: - - clarin-v9 + - dtq-dev-93 pull_request: workflow_dispatch: permissions: contents: read # to fetch code (actions/checkout) - packages: write # to write images to GitHub Container Registry (GHCR) jobs: ############################################################# - # Build/Push the 'ufal/dspace-angular' image ('-dev' tag) + # Build/Push the 'dataquest/dspace-angular' image ('-dev' tag) ############################################################# dspace-angular: - # Ensure this job never runs on forked repos. It's only executed for 'ufal/dspace-angular' - if: github.repository == 'ufal/dspace-angular' - # Use the reusable-docker-build.yml script from ufal/clarin-dspace repo to build our Docker image - uses: ufal/clarin-dspace/.github/workflows/reusable-docker-build.yml@clarin-v9 + # Ensure this job never runs on forked repos. It's only executed for 'dataquest-dev/dspace-angular' + if: github.repository == 'dataquest-dev/dspace-angular' + # Use the reusable-docker-build.yml script from dataquest-dev/DSpace repo to build our Docker image + uses: dataquest-dev/DSpace/.github/workflows/reusable-docker-build.yml@dtq-dev with: build_id: dspace-angular-dev - image_name: ufal/dspace-angular + image_name: dataquest/dspace-angular dockerfile_path: ./Dockerfile # As this is a development image, its tags are all suffixed with "-dev". Otherwise, it uses the same - # tagging logic as the primary 'ufal/dspace-angular' image below. + # tagging logic as the primary 'dataquest/dspace-angular' image below. tags_flavor: suffix=-dev run_python_version_script: true python_version_script_dest: src/static-files/VERSION_D.html @@ -39,20 +40,32 @@ jobs: DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} ############################################################# - # Build/Push the 'ufal/dspace-angular' image. - # This is the production ("dist") build, published under the plain (un-suffixed) tag. + # Build/Push the 'dataquest/dspace-angular' image. + # This is the production ("dist") build and, matching 'dtq-dev', + # it is the one published under the plain (un-suffixed) tag. ############################################################# dspace-angular-dist: - # Ensure this job never runs on forked repos. It's only executed for 'ufal/dspace-angular' - if: github.repository == 'ufal/dspace-angular' - # Use the reusable-docker-build.yml script from ufal/clarin-dspace repo to build our Docker image - uses: ufal/clarin-dspace/.github/workflows/reusable-docker-build.yml@clarin-v9 + # Ensure this job never runs on forked repos. It's only executed for 'dataquest-dev/dspace-angular' + if: github.repository == 'dataquest-dev/dspace-angular' + # Use the reusable-docker-build.yml script from dataquest-dev/DSpace repo to build our Docker image + uses: dataquest-dev/DSpace/.github/workflows/reusable-docker-build.yml@dtq-dev with: build_id: dspace-angular - image_name: ufal/dspace-angular + image_name: dataquest/dspace-angular dockerfile_path: ./Dockerfile.dist run_python_version_script: true python_version_script_dest: src/static-files/VERSION_D.html secrets: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + deploy: + needs: dspace-angular + if: ${{ github.event_name != 'pull_request' }} + uses: ./.github/workflows/deploy.yml + with: + INSTANCE: '8603' + IMPORT: false + ERASE_DB: false + DEV_MACHINE: 'dev-6' + secrets: inherit diff --git a/.github/workflows/erase_db.yml b/.github/workflows/erase_db.yml new file mode 100644 index 00000000000..f3526c680dd --- /dev/null +++ b/.github/workflows/erase_db.yml @@ -0,0 +1,29 @@ +name: Erase database + +on: + workflow_dispatch: + inputs: + INSTANCE: + required: true + default: '8' + type: choice + options: + - '5' + - '8' + - '4' + + +jobs: + erase_db: + runs-on: dspace-dep-1 + timeout-minutes: 5 + env: + INSTANCE: ${{ inputs.INSTANCE }} + steps: + + - uses: actions/checkout@v4 + + - uses: ./.github/actions/erase-db + with: + INSTANCE: ${{ env.INSTANCE }} + NAME: dspace-${{ env.INSTANCE }} diff --git a/.github/workflows/new_issue_assign.yml b/.github/workflows/new_issue_assign.yml new file mode 100644 index 00000000000..03c1b28a68a --- /dev/null +++ b/.github/workflows/new_issue_assign.yml @@ -0,0 +1,16 @@ +name: New issue assign +on: + issues: + types: [opened] + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v0.5.0 + with: + # You can target a project in a different organization + # to the issue + project-url: https://github.com/orgs/dataquest-dev/projects/12 + github-token: ${{ secrets.PAT_ISSUE_MGMT }} diff --git a/.github/workflows/new_issue_label.yml b/.github/workflows/new_issue_label.yml new file mode 100644 index 00000000000..b759334e22f --- /dev/null +++ b/.github/workflows/new_issue_label.yml @@ -0,0 +1,17 @@ +name: Auto Label New Issues + +on: + issues: + types: [opened] + +jobs: + label-issue: + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - name: Auto Label + uses: dataquest-dev/gh-actions/start@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/playwright-tests.yml b/.github/workflows/playwright-tests.yml new file mode 100644 index 00000000000..ae749a48d7c --- /dev/null +++ b/.github/workflows/playwright-tests.yml @@ -0,0 +1,48 @@ +name: Playwright tests + +on: + workflow_dispatch: + inputs: + ui_tests_ref: + description: 'Branch or tag of dataquest-dev/dspace-ui-tests to check out' + required: false + type: string + default: master + workflow_call: + inputs: + ui_tests_ref: + description: 'Branch or tag of dataquest-dev/dspace-ui-tests to check out' + required: false + type: string + default: master + +jobs: + playwright-tests: + runs-on: dspace-test-1 + timeout-minutes: 120 + steps: + - name: Checkout Playwright tests + uses: actions/checkout@v4 + with: + repository: dataquest-dev/dspace-ui-tests + ref: ${{ inputs.ui_tests_ref }} + path: dspace-ui-tests + token: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} + + - name: test + working-directory: dspace-ui-tests/scripts + env: + HOME_URL: http://dev-6.pc:8603/repository/ + NAME: LINDAT-9 + PASSWORD_ADMIN: ${{ secrets.DSPACE_ADMIN_PASSWORD }} + # Five minutes under the job limit, so the suite gives up on its own. + # A job that the limit cancels concludes 'cancelled' whatever its steps do, + # and a cancelled run reads as 'nothing is red' although nothing was measured. + timeout-minutes: 115 + run: | + ./test.sh + + - uses: mazoea/ga-maz/end@master + with: + CHOWN_DIR: ./ + if: ${{ always() }} \ No newline at end of file diff --git a/.github/workflows/redeploy-weekly.yml b/.github/workflows/redeploy-weekly.yml new file mode 100644 index 00000000000..b42562e0325 --- /dev/null +++ b/.github/workflows/redeploy-weekly.yml @@ -0,0 +1,23 @@ +name: Redeploy Weekly + +# Replaces the old "Import Weekly": instance 8603 is not re-imported on a schedule. +# This only redeploys, which is non-destructive -- start.sh pulls the images first, so the +# instance picks up the latest dtq-dev-93 build. The database and assetstore are left +# alone (IMPORT and ERASE_DB both false). +# +# To load a dump, run "Deploy DSpace" manually with IMPORT checked. +on: + schedule: + - cron: '0 0 * * 0' # every Sunday at midnight UTC + workflow_dispatch: + +jobs: + redeploy: + uses: ./.github/workflows/deploy.yml + with: + # Must match a job in deploy.yml, otherwise every job is skipped and this run + # still reports success. + INSTANCE: '8603' + IMPORT: false + ERASE_DB: false + secrets: inherit diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 4c09e1b027b..5717f1a89f2 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -6,7 +6,7 @@ on: - '**' env: - IMAGE_BASE_NAME: ufal/dspace-angular + IMAGE_BASE_NAME: dataquest/dspace-angular jobs: retag-FE-image: diff --git a/.github/workflows/trigger-builds.yml b/.github/workflows/trigger-builds.yml new file mode 100644 index 00000000000..1b5ce0b4da8 --- /dev/null +++ b/.github/workflows/trigger-builds.yml @@ -0,0 +1,29 @@ +name: Trigger Build for All Customer Branches + +on: + schedule: + - cron: "0 */4 * * *" # Runs every 4 hours + workflow_dispatch: # Allows manual triggering + +permissions: + actions: write # Grants permission to trigger workflows + contents: read # Access to repository contents + +jobs: + trigger-builds: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 # Ensures the repository is available + + - name: Get and Trigger Customer Branch Builds + run: | + # Authenticate with GitHub CLI using the token + echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + + git fetch --prune origin # Ensure remote refs are fetched + BRANCHES=$(git ls-remote --heads origin | awk -F'/' '{print $3"/"$4}' | grep '^customer/') + for branch in $(echo "$BRANCHES" | sed -e 's/[\[\]"]//g' -e 's/,/\n/g'); do + echo "Triggering build for branch: $branch" + gh workflow run build.yml --ref $branch + done diff --git a/.github/workflows/trigger-ui-tests.yml b/.github/workflows/trigger-ui-tests.yml new file mode 100644 index 00000000000..f0d53a564b8 --- /dev/null +++ b/.github/workflows/trigger-ui-tests.yml @@ -0,0 +1,37 @@ +name: Trigger UI Tests for All Customer Branches + +on: + workflow_dispatch: + workflow_call: + schedule: + - cron: '0 5 * * *' + +permissions: + actions: write # Grants permission to trigger workflows + contents: read # Access to repository contents + +jobs: + trigger-builds: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get and Trigger Customer Branch UI Tests + run: | + # Authenticate with GitHub CLI using the token + echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token + + git fetch --prune origin + BRANCHES=$(git ls-remote --heads origin | awk -F'/' '{print $3"/"$4}' | grep '^customer/') + SKIP_BRANCHES=("customer/uk" "customer/mendelu-v7" "customer/palo-docker" "customer/palo-docker-rebase" "customer/palo-docker-typo-fix") + + for branch in $(echo "$BRANCHES" | sed -e 's/[\[\]"]//g' -e 's/,/\n/g'); do + if [[ " ${SKIP_BRANCHES[@]} " =~ " ${branch} " ]]; then + echo "Skipping branch $branch" + continue + fi + + echo "Triggering UI tests for branch: $branch" + gh workflow run playwright-tests.yml --ref $branch + done \ No newline at end of file diff --git a/scripts/sourceversion.py b/scripts/sourceversion.py index 894b5569a1d..c6d50504613 100644 --- a/scripts/sourceversion.py +++ b/scripts/sourceversion.py @@ -9,7 +9,7 @@ # It must also cooperate with argparse # the idea is, that this will be different on each branch, but could be possibly passed by argv/argparse -RELEASE_TAG_BASE='lindat' +RELEASE_TAG_BASE='none' def get_time_in_timezone(zone: str = "Europe/Bratislava"): try: @@ -32,7 +32,7 @@ def get_time_in_timezone(zone: str = "Europe/Bratislava"): link = sys.argv[1] + sys.argv[2] print('

Build run:

' + link + ' ') - link = "https://github.com/ufal/dspace-angular/releases/tag/" \ + link = "https://github.com/dataquest-dev/dspace-angular/releases/tag/" \ + RELEASE_TAG_BASE + "-" + datetime.now().strftime('%Y.%m.') + sys.argv[2] print('

Release link:

' + link + ' (if it does not work, then this is not an official release instance) ') From 20e3dc309e98c4e2e37027ccf7e76f66f4d40d74 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Thu, 19 Nov 2026 16:04:39 +0100 Subject: [PATCH 2/2] Deploy 8603 only after both FE images are pushed The instance runs the plain dtq-dev-93 tag, which the dspace-angular-dist job builds. Waiting only for the -dev image job let the deploy start while the dist image was still building, so it could pull the previous image. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0faf684fbfa..ca10ba8bf1e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -60,7 +60,7 @@ jobs: DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} deploy: - needs: dspace-angular + needs: [dspace-angular, dspace-angular-dist] if: ${{ github.event_name != 'pull_request' }} uses: ./.github/workflows/deploy.yml with: