-
Notifications
You must be signed in to change notification settings - Fork 928
132 lines (111 loc) · 5.34 KB
/
update-ref-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Update Privacy Reference Tests
on:
schedule:
- cron: '0 1 * * *' # run at 1 AM UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-ref-tests:
name: Update reference tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install npm-check-updates
run: npm install -g npm-check-updates
- name: Install copy-files-from-to
run: npm install -g copy-files-from-to
- name: Check for updates
id: update-check
continue-on-error: true
run: ncu @duckduckgo/privacy-reference-tests --errorLevel 2
- name: Update reference steps
if: ${{ steps.update-check.outcome == 'failure' }}
run: ncu @duckduckgo/privacy-reference-tests -u
- name: Install package
if: ${{ steps.update-check.outcome == 'failure' }}
run: npm update
- name: Copy files
if: ${{ steps.update-check.outcome == 'failure' }}
run: copy-files-from-to
- name: Find latest release version of Content Scope scripts in package.json
if: ${{ steps.update-check.outcome == 'failure' }}
id: find-latest-release
uses: notiz-dev/github-action-json-property@release
with:
path: 'package.json'
prop_path: 'dependencies.@duckduckgo/privacy-reference-tests'
- name: Extract release version
if: ${{ steps.update-check.outcome == 'failure' }}
uses: rishabhgupta/split-by@v1
id: extract-release-version
with:
string: ${{steps.find-latest-release.outputs.prop}}
split-by: '#'
- name: Create Pull Request in Android repo
if: ${{ steps.update-check.outcome == 'failure' }}
env:
RELEASE_VERSION: ${{ steps.extract-release-version.outputs._1}}
id: create-pr
uses: peter-evans/[email protected]
with:
base: "develop"
title: Update reference tests to version ${{ steps.extract-release-version.outputs._1}}
author: daxmobile <[email protected]>
token: ${{ secrets.GT_DAXMOBILE }}
commit-message: Update content scope scripts to version ${{ steps.extract-release-version.outputs._1}}
labels: reference tests, automated pr
branch: automated/update-ref-tests-dependencies-${{ steps.extract-release-version.outputs._1}}
body: |
- Automated reference tests dependency update
This PR updates the reference tests dependency to the latest available version and copies the necessary files.
If tests have failed, see https://app.asana.com/0/0/1203766026095653/f for further information on what to do next.
- [ ] All tests must pass
- name: Create Asana task in Android App project
if: ${{ steps.update-check.outcome == 'failure' }}
id: create-task
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: Update reference tests to version ${{ steps.extract-release-version.outputs._1}}
asana-task-description: |
Reference tests have been updated and a PR created.
If tests failed check out https://app.asana.com/0/0/1203766026095653/f for further information on what to do next.
See ${{ steps.create-pr.outputs.pull-request-url }}
action: 'create-asana-task'
- name: Add Asana task to Release Board project
if: ${{ steps.create-task.outputs.duplicate == 'false' }}
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_RELEASE_BOARD_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_RELEASE_BOARD_PR_SECTION_ID }}
asana-task-id: ${{ steps.create-task.outputs.taskId }}
action: 'add-task-asana-project'
- name: Update PR description with Asana task
if: ${{ steps.create-task.outputs.duplicate == 'false' }}
uses: duckduckgo/[email protected]
with:
github-pat: ${{ secrets.GT_DAXMOBILE }}
github-pr: ${{ steps.create-pr.outputs.pull-request-number }}
github-repository: 'android'
github-org: 'duckduckgo'
asana-project: ${{ vars.GH_ANDROID_RELEASE_BOARD_PROJECT_ID }}
asana-task-id: ${{ steps.create-task.outputs.taskId }}
action: 'add-task-pr-description'
- name: Create Asana task when workflow failed
if: ${{ failure() }}
uses: duckduckgo/[email protected]
with:
asana-pat: ${{ secrets.GH_ASANA_SECRET }}
asana-project: ${{ vars.GH_ANDROID_APP_PROJECT_ID }}
asana-section: ${{ vars.GH_ANDROID_APP_INCOMING_SECTION_ID }}
asana-task-name: GH Workflow Failure - Update reference tests
asana-task-description: The update reference tests workflow has failed. See https://github.com/duckduckgo/Android/actions/runs/${{ github.run_id }}
action: 'create-asana-task'