-
Notifications
You must be signed in to change notification settings - Fork 10
103 lines (88 loc) · 3.23 KB
/
upstream-builds-query.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
name: "Upstream Builds Query Action"
on:
pull_request:
paths:
- "actions/upstream-builds-query/**"
- ".github/workflows/upstream-builds-query.yml"
push:
branches:
- main
paths:
- "actions/upstream-builds-query/**"
- ".github/workflows/upstream-builds-query.yml"
workflow_dispatch:
defaults:
run:
working-directory: ./actions/upstream-builds-query
jobs:
upstream-builds-query-dist:
name: Verify committed dist directory
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "12"
- name: Calculate hash of committed `dist` directory
run: echo "COMMITTED_HASH=${{ hashFiles('./dist/**') }}" >> $GITHUB_ENV
- run: yarn install
- name: Calculate expected hash of `dist` directory
run: |
rm -rf dist && npm run prepare
echo "EXPECTED_HASH=${{ hashFiles('./dist/**') }}" >> $GITHUB_ENV
- name: Compare committed and expected hashes
run: |
echo "COMMITTED_HASH: ${{ env.COMMITTED_HASH }}"
echo "EXPECTED_HASH: ${{ env.EXPECTED_HASH }}"
export RESULT=$(expr "${{ env.COMMITTED_HASH }}" != "${{ env.EXPECTED_HASH }}")
echo "RESULT: $RESULT"
exit $RESULT
upstream-builds-query-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "12"
- run: yarn install
- run: yarn run test
upstream-builds-query-e2e-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/upstream-builds-query
id: upstream-builds-query
with:
upstream-builds: |
[
{
"module": "github.com/keep-network/keep-core",
"ref": "",
"version": "wrong-version",
"url": ""
},
{
"module": "github.com/keep-network/keep-core/solidity",
"ref": "rfc-18/integration",
"version": "1.2.3-rc.0+feature.123sda",
"url": "https://github.com/keep-network/keep-core/actions/runs/770505797"
},
{
"module": "github.com/keep-network/keep-core",
"ref": "rfc-18/integration",
"version": "b454cc275c8d3d0e609639cd85244a099fa8ee69",
"url": "https://github.com/keep-network/keep-core/actions/runs/770692548"
}
]
query: |
keep-core-contracts-version = github.com/keep-network/keep-core/solidity#version
keep-core-version = github.com/keep-network/keep-core#version
# Verify outputs of the previous step.
- name: Validate `keep-core-contracts-version`
run: exit $(expr "${{ steps.upstream-builds-query.outputs.keep-core-contracts-version }}" != "1.2.3-rc.0+feature.123sda")
- name: Validate `keep-core-version`
run: exit $(expr "${{ steps.upstream-builds-query.outputs.keep-core-version }}" != "b454cc275c8d3d0e609639cd85244a099fa8ee69")