@duckduckgo/autoconsent 12.16.0 → 12.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,20 +10,21 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
  if: github.event.pull_request.merged == true
12
12
  steps:
13
- - name: Find Asana task ID
14
- id: find-task
15
- uses: duckduckgo/native-github-asana-sync@v1.5
13
+ - name: Find Asana task ID(s)
14
+ id: find-tasks
15
+ uses: duckduckgo/native-github-asana-sync@main
16
16
  with:
17
- action: 'find-asana-task-id'
17
+ action: 'find-asana-task-ids'
18
18
  asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }}
19
19
  trigger-phrase: 'Task/Issue URL:'
20
+ asana-project: '1203268166580279' # CPM (Cookie Pop-up Management) Triage project
20
21
 
21
- - name: Move task to "Scheduled for release" section
22
- if: steps.find-task.outputs.asanaTaskId
23
- uses: duckduckgo/native-github-asana-sync@v1.5
22
+ - name: Move task(s) to "Scheduled for release" section
23
+ if: steps.find-tasks.outputs.asanaTaskIds
24
+ uses: duckduckgo/native-github-asana-sync@main
24
25
  with:
25
26
  action: 'add-task-asana-project'
26
27
  asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }}
27
28
  asana-project: '1203268166580279' # CPM (Cookie Pop-up Management) Triage project
28
29
  asana-section: '1207140808076253' # "Scheduled for release" section ID
29
- asana-task-id: ${{ steps.find-task.outputs.asanaTaskId }}
30
+ asana-task-id: ${{ steps.find-tasks.outputs.asanaTaskIds }}
@@ -10,28 +10,29 @@ jobs:
10
10
  process-asana-tasks:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - name: Add comment to Asana task
14
- uses: duckduckgo/native-github-asana-sync@v1.5
13
+ - name: Add comment to Asana task(s)
14
+ uses: duckduckgo/native-github-asana-sync@main
15
15
  with:
16
16
  action: 'add-asana-comment'
17
17
  asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }}
18
18
  trigger-phrase: 'Task/Issue URL:'
19
- is-pinned: 'false'
19
+ asana-project: '1203268166580279' # CPM (Cookie Pop-up Management) Triage project
20
20
 
21
- - name: Find Asana task ID
22
- id: find-task
23
- uses: duckduckgo/native-github-asana-sync@v1.5
21
+ - name: Find Asana task ID(s)
22
+ id: find-tasks
23
+ uses: duckduckgo/native-github-asana-sync@main
24
24
  with:
25
- action: 'find-asana-task-id'
25
+ action: 'find-asana-task-ids'
26
26
  asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }}
27
27
  trigger-phrase: 'Task/Issue URL:'
28
+ asana-project: '1203268166580279' # CPM (Cookie Pop-up Management) Triage project
28
29
 
29
- - name: Move task to "Awaiting review" section
30
- if: steps.find-task.outputs.asanaTaskId
31
- uses: duckduckgo/native-github-asana-sync@v1.5
30
+ - name: Move task(s) to "Awaiting review" section
31
+ if: steps.find-tasks.outputs.asanaTaskIds
32
+ uses: duckduckgo/native-github-asana-sync@main
32
33
  with:
33
34
  action: 'add-task-asana-project'
34
35
  asana-pat: ${{ secrets.ASANA_ACCESS_TOKEN }}
35
36
  asana-project: '1203268166580279' # CPM (Cookie Pop-up Management) Triage project
36
37
  asana-section: '1209767000096488' # "Awaiting review" section ID
37
- asana-task-id: ${{ steps.find-task.outputs.asanaTaskId }}
38
+ asana-task-id: ${{ steps.find-tasks.outputs.asanaTaskIds }}
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ # v12.17.0 (Mon Apr 14 2025)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Update EasyList Cookie to e1d6329233498d8cb5a5fe473e516475ee3da6e8 [#713](https://github.com/duckduckgo/autoconsent/pull/713) ([@sammacbeth](https://github.com/sammacbeth) [@github-actions[bot]](https://github.com/github-actions[bot]))
6
+ - Bump the dev-dependencies group across 1 directory with 5 updates [#715](https://github.com/duckduckgo/autoconsent/pull/715) ([@dependabot[bot]](https://github.com/dependabot[bot]))
7
+ - Add rule for nos.nl [#712](https://github.com/duckduckgo/autoconsent/pull/712) ([@noisysocks](https://github.com/noisysocks))
8
+ - Update EasyList Cookie to 54998140e5d5e212ead7be504a42fe3afb8cfdc6 [#708](https://github.com/duckduckgo/autoconsent/pull/708) ([@sammacbeth](https://github.com/sammacbeth) [@github-actions[bot]](https://github.com/github-actions[bot]))
9
+
10
+ #### 🐛 Bug Fix
11
+
12
+ - Jenkins CI: Use GIT_COMMIT when notifying GitHub [#714](https://github.com/duckduckgo/autoconsent/pull/714) ([@noisysocks](https://github.com/noisysocks))
13
+ - Update Asana integration to support multiple tasks and ignore tasks not in CPM project [#707](https://github.com/duckduckgo/autoconsent/pull/707) ([@noisysocks](https://github.com/noisysocks))
14
+ - Update CI pipeline to run only relevant tests for a PR [#710](https://github.com/duckduckgo/autoconsent/pull/710) ([@noisysocks](https://github.com/noisysocks))
15
+ - Fix HTML formatting for task list in release notes [#705](https://github.com/duckduckgo/autoconsent/pull/705) ([@noisysocks](https://github.com/noisysocks))
16
+
17
+ #### ⚠️ Pushed to `main`
18
+
19
+ - Try main branch of native-github-asana-sync ([@noisysocks](https://github.com/noisysocks))
20
+ - Try a different build of native-github-asana-sync ([@noisysocks](https://github.com/noisysocks))
21
+ - Try different build of native-github-asana-sync ([@noisysocks](https://github.com/noisysocks))
22
+
23
+ #### Authors: 4
24
+
25
+ - [@dependabot[bot]](https://github.com/dependabot[bot])
26
+ - [@github-actions[bot]](https://github.com/github-actions[bot])
27
+ - Robert Anderson ([@noisysocks](https://github.com/noisysocks))
28
+ - Sam Macbeth ([@sammacbeth](https://github.com/sammacbeth))
29
+
30
+ ---
31
+
1
32
  # v12.16.0 (Tue Mar 25 2025)
2
33
 
3
34
  #### 🚀 Enhancement
package/Jenkinsfile CHANGED
@@ -1,9 +1,10 @@
1
- def runPlaywrightTests(resultDir, browser, grep) {
1
+ def runPlaywrightTests(resultDir, browser, testFiles) {
2
2
  try {
3
3
  timeout(120) {
4
+ def testFilesArg = testFiles.join(' ')
4
5
  sh """
5
6
  rm -f results.xml
6
- PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test tests/_sample-test.spec.ts --project $browser --reporter=junit --grep "$grep"|| true
7
+ PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test ${testFilesArg} --project ${browser} --reporter=junit || true
7
8
  """
8
9
  }
9
10
  } finally {
@@ -19,13 +20,46 @@ def withEnvFile(envfile, Closure cb) {
19
20
  }
20
21
  }
21
22
 
23
+ def getModifiedFiles() {
24
+ if (env.CHANGE_ID) {
25
+ def changedFiles = sh(script: "git diff --name-only origin/${env.CHANGE_TARGET} HEAD", returnStdout: true).trim()
26
+ return changedFiles.split("\n")
27
+ } else {
28
+ return []
29
+ }
30
+ }
31
+
32
+ def getTestsToRun(modifiedFiles) {
33
+ def testsToRun = []
34
+
35
+ // Run any modified test files
36
+ for (file in modifiedFiles) {
37
+ if (file.startsWith("tests/") && file.endsWith(".spec.ts")) {
38
+ testsToRun.add(file)
39
+ }
40
+ }
41
+
42
+ // Run the corresponding test file for any modified rule file
43
+ for (file in modifiedFiles) {
44
+ if (file.startsWith("rules/autoconsent/") && file.endsWith(".json")) {
45
+ def fileName = file.substring("rules/autoconsent/".length())
46
+ def baseName = fileName.substring(0, fileName.lastIndexOf(".json"))
47
+ def testFile = "tests/${baseName}.spec.ts"
48
+
49
+ if (fileExists(testFile) && !testsToRun.contains(testFile)) {
50
+ testsToRun.add(testFile)
51
+ }
52
+ }
53
+ }
54
+
55
+ return testsToRun
56
+ }
57
+
22
58
  pipeline {
23
59
  agent { label 'autoconsent-crawler' }
24
60
  parameters {
25
61
  string(name: 'TEST_RESULT_ROOT', defaultValue: '/mnt/efs/users/smacbeth/autoconsent/ci', description: 'Where test results and configuration are stored')
26
62
  choice(name: 'BROWSER', choices: ['chrome', 'webkit', 'iphoneSE', 'firefox'], description: 'Browser')
27
- string(name: 'GREP', defaultValue: '', description: 'filter for tests matching a specific string')
28
- string(name: 'NSITES', defaultValue: '1', description: 'number of sites to test per CMP')
29
63
  string(name: 'BRANCH', defaultValue: 'main', description: 'Branch or PR to checkout (e.g. pr/123)')
30
64
  }
31
65
  environment {
@@ -44,10 +78,10 @@ pipeline {
44
78
  steps {
45
79
  checkout([$class: 'GitSCM', branches: [[name: "${params.BRANCH}"]],
46
80
  extensions: [[$class: 'LocalBranch']],
47
- userRemoteConfigs: [[refspec: "+refs/pull/*/head:refs/remotes/origin/pr/*", credentialsId: 'GitHubAccess', url: 'https://github.com/duckduckgo/autoconsent.git']]])
81
+ userRemoteConfigs: [[refspec: "+refs/pull/*/head:refs/remotes/origin/pr/*", credentialsId: 'autoconsent-rw', url: 'https://github.com/duckduckgo/autoconsent.git']]])
48
82
  }
49
83
  }
50
-
84
+
51
85
  stage('Build') {
52
86
  steps {
53
87
  sh '''
@@ -63,13 +97,22 @@ pipeline {
63
97
  }
64
98
  }
65
99
  }
66
-
100
+
67
101
  stage('Test') {
68
102
  steps {
69
- script {
103
+ script {
70
104
  def testsFailed = 0
71
105
  def testsTotal = 0
72
- withEnv(["NSITES=${params.NSITES}}"]) {
106
+
107
+ def modifiedFiles = getModifiedFiles()
108
+ echo "Modified files: ${modifiedFiles.join(', ')}"
109
+
110
+ def testsToRun = getTestsToRun(modifiedFiles)
111
+ echo "Tests to run: ${testsToRun.join(', ')}"
112
+
113
+ if (testsToRun.isEmpty()) {
114
+ echo "No tests to run for this change"
115
+ } else {
73
116
  def testEnvs = [
74
117
  "${params.TEST_RESULT_ROOT}/de.env",
75
118
  "${params.TEST_RESULT_ROOT}/us.env",
@@ -77,19 +120,32 @@ pipeline {
77
120
  ]
78
121
  for (testEnv in testEnvs) {
79
122
  withEnvFile(testEnv) {
80
- def summary = runPlaywrightTests(params.TEST_RESULT_ROOT, params.BROWSER, params.GREP)
123
+ def summary = runPlaywrightTests(params.TEST_RESULT_ROOT, params.BROWSER, testsToRun)
81
124
  testsFailed += summary.failCount
82
125
  testsTotal += summary.totalCount
83
126
  }
84
- }
127
+ }
128
+ }
129
+
130
+ def status = 'SUCCESS'
131
+ def description = "No tests to run"
132
+
133
+ if (testsTotal > 0) {
134
+ description = "${testsFailed}/${testsTotal} failed"
135
+ if (testsFailed > 0) {
136
+ status = 'FAILURE'
137
+ }
85
138
  }
139
+
86
140
  githubNotify(
87
- account: 'duckduckgo',
88
- repo: 'autoconsent',
89
- context: 'Tests / Coverage sample',
90
- sha: "${env.GIT_COMMIT}",
91
- description: "${testsFailed}/${testsTotal} failed",
92
- status: testsFailed > 50 ? 'FAILURE' : 'SUCCESS')
141
+ account: 'duckduckgo',
142
+ repo: 'autoconsent',
143
+ context: 'Tests / Changed files',
144
+ sha: "${env.GIT_COMMIT}",
145
+ description: description,
146
+ status: status,
147
+ credentialsId: 'autoconsent-rw'
148
+ )
93
149
  }
94
150
  }
95
151
  }
@@ -112,9 +112,9 @@ const processReleaseTasks = async () => {
112
112
  return '';
113
113
  }
114
114
 
115
- let taskListHtml = '<strong>Tasks included in this release:</strong>\n<ul>';
115
+ let taskListHtml = '<strong>Tasks included in this release:</strong>\n<ul>\n';
116
116
  for (const task of tasks) {
117
- taskListHtml += getLink(task.permalink_url) + '\n';
117
+ taskListHtml += '<li>' + getLink(task.permalink_url) + '</li>\n';
118
118
  await asana.tasks.updateTask(task.gid, { completed: true });
119
119
  }
120
120
  taskListHtml += '</ul>';