Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup npm cache
uses: actions/cache@v4
with:
path: '~/.npm'
key: ${{ runner.os }}-node
key: ${{ runner.os }}-node-24-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node
${{ runner.os }}-node-24-

- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: '24'

- name: Install dependencies
run: |
npm install

- name: Install Cypress
run: |
npm install cypress@9.7.0
./node_modules/.bin/cypress install
npm run cypress:install

- name: Run Cypress
- name: Run test
run: |
./node_modules/.bin/cypress run
npm test

deploy:
needs: [test]
environment:
Expand All @@ -51,11 +60,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
# Upload entire repository
path: '.'
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup npm cache
uses: actions/cache@v4
with:
path: '~/.npm'
key: ${{ runner.os }}-node
key: ${{ runner.os }}-node-24-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node
${{ runner.os }}-node-24-

- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: '24'

- name: Install dependencies
run: |
npm install

- name: Install Cypress
run: |
npm install cypress@9.7.0
./node_modules/.bin/cypress install
npm run cypress:install

- name: Run Cypress
- name: Run test
run: |
./node_modules/.bin/cypress run
npm test
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Software Heritage (SWH) archive, which will improve findability in searches.

### Functionalities

- helpers while completing the form, for example a reference list of SDPX
- helpers while completing the form, for example a reference list of SPDX
licenses
- a validation mechanism after submission
- the possibility to use all the CodeMeta terms and Schema.org terms
Expand Down Expand Up @@ -84,19 +84,20 @@ then open [http://localhost:8000/](http://localhost:8000/) in your web browser.
In addition to manual testing, we have automated tests to check for bugs
quickly, using [Cypress](https://www.cypress.io/).

To run them, first install Cypress:
To run them, first make sure you have npm and Cypress installed on your system.
From the project root, run:

```shell
sudo apt install npm # or the equivalent on your system
npx cypress@9.7.0 install
npm run cypress:install
```

Then, run the tests:

```shell
npx cypress@9.7.0 run
npm test
```

## Contributed by

![Image description](https://annex.softwareheritage.org/public/logo/software-heritage-logo-title-motto.svg)
![Software Heritage](https://annex.softwareheritage.org/public/logo/software-heritage-logo-title-motto.svg)
8 changes: 8 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
specPattern: 'cypress/integration/**/*.js',
supportFile: 'cypress/support/index.js',
},
})
5 changes: 0 additions & 5 deletions cypress.json

This file was deleted.

3 changes: 2 additions & 1 deletion cypress/integration/special_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/

/*
* Tests the author/contributor dynamic fieldsets
* Tests fields that need special treatment.
* For example, URLs and newlines handling.
*/

"use strict";
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/*
* Tests the basic features of the application.
* Tests the validation of field values and CodeMeta document
*/

"use strict";
Expand Down
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "codemeta-generator",
"version": "3.0",
"description": "Client-side web app to generate CodeMeta documents",
"private": true,
"scripts": {
"test": "npx cypress run",
"cypress:open": "npx cypress open",
"cypress:install": "npx cypress install"
},
"engines": {
"node": ">=20"
},
"devDependencies": {
"cypress": "^15.3.0"
},
"license": "AGPL-3.0-or-later"
}