Skip to content

Commit 574f931

Browse files
authored
ci.yml and update tests
ci.yml and update tests
2 parents 49d9a05 + cd8c384 commit 574f931

File tree

4 files changed

+120
-536
lines changed

4 files changed

+120
-536
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
# Check for updates to GitHub Actions every week
16+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
node-version: [20, 22]
21+
22+
steps:
23+
- uses: actions/checkout@v6
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- run: npm ci
29+
- run: npm run lint --if-present
30+
- run: npm test
31+
- run: npm run build --if-present
32+
- name: Save build
33+
if: matrix.node-version == 20
34+
uses: actions/upload-artifact@v6
35+
with:
36+
name: build
37+
path: |
38+
.
39+
!node_modules
40+
retention-days: 1
41+
42+
dependabot:
43+
name: 'Dependabot'
44+
needs: build # After the E2E and build jobs, if one of them fails, it won't merge the PR.
45+
runs-on: ubuntu-latest
46+
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
47+
permissions:
48+
contents: write
49+
pull-requests: write
50+
steps:
51+
- name: Enable auto-merge for Dependabot PRs
52+
run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
53+
env:
54+
PR_URL: ${{github.event.pull_request.html_url}}
55+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
56+
57+
npm-publish-build:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
permissions:
61+
id-token: write
62+
contents: read
63+
steps:
64+
- uses: actions/download-artifact@v7
65+
with:
66+
name: build
67+
- uses: actions/setup-node@v6
68+
with:
69+
node-version: 20
70+
registry-url: 'https://registry.npmjs.org'
71+
- name: Update npm to latest (required for OIDC)
72+
run: npm install -g npm@latest
73+
- uses: rlespinasse/github-slug-action@v3.x
74+
- name: Append commit hash to package version
75+
run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
76+
- name: Disable pre- and post-publish actions
77+
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
78+
- name: Publish to npm
79+
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
80+
run: npm publish --tag ${{ env.GITHUB_REF_SLUG }} --ignore-scripts
81+
82+
npm-publish-latest:
83+
needs: [build, npm-publish-build]
84+
runs-on: ubuntu-latest
85+
if: github.ref == 'refs/heads/main'
86+
permissions:
87+
id-token: write # Required for OIDC
88+
contents: read
89+
steps:
90+
- uses: actions/download-artifact@v7
91+
with:
92+
name: build
93+
- uses: actions/setup-node@v6
94+
with:
95+
node-version: 20
96+
registry-url: 'https://registry.npmjs.org'
97+
- name: Update npm to latest (required for OIDC)
98+
run: npm install -g npm@latest
99+
- name: Disable pre- and post-publish actions
100+
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
101+
- name: Publish to npm
102+
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
103+
run: npm publish --tag latest --ignore-scripts

test/integration/N3Patch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe('A Server supporting N3 Patch', (): void => {
158158
await setResource('/write-only', '<a> <b> ( <c> <d> ).', { write: true });
159159
await expectPatch(
160160
{ path: '/write-only', body: `<> a solid:InsertDeletePatch; solid:inserts { <x> <y> <z>. }.` },
161-
{ status: 205, turtle: `@prefix : </write-only#>.\n@prefix loc: </>.\n\nloc:a loc:b ( loc:c loc:d ).\n\nloc:x loc:y loc:z.\n\n` },
161+
{ status: 205, turtle: `@prefix : </write-only#>.\n\n</a> </b> ( </c> </d> ).\n\n</x> </y> </z>.\n\n` },
162162
true,
163163
);
164164
});

0 commit comments

Comments
 (0)