-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (79 loc) · 2.98 KB
/
zxc-analyze-snap.yaml
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
name: "ZXC: Test Snap"
on:
workflow_call:
inputs:
snap-package-dir:
description: "The directory of the snap package to test:"
type: string
required: true
snap-report-name:
description: "The name of the snap project being tested:"
type: string
required: true
custom-job-label:
description: "Custom Job Label:"
type: string
required: false
default: "Analyze"
secrets:
codecov-token:
description: "Codecov Token"
required: true
codacy-project-token:
description: "Codacy Project Token"
required: true
defaults:
run:
shell: bash
permissions:
id-token: write
issues: write
checks: write
pull-requests: write
contents: read
env:
PROJECT_DIRECTORY: packages/${{ inputs.snap-package-dir }}
SNAP_DIRECTORY: packages/${{ inputs.snap-package-dir }}/packages/snap
jobs:
analyze:
name: ${{ inputs.custom-job-label || 'Analyze' }}
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-sudo: true
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
- name: Fetch Snap Unit Test Reports
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.snap-report-name }} Unit Test Reports
path: ${{ env.SNAP_DIRECTORY }}/junit*.xml
- name: Fetch Snap Coverage Reports
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: ${{ inputs.snap-report-name }} Coverage Reports
path: ${{ env.SNAP_DIRECTORY }}/coverage
- name: Show Snap Contents
run: ls -la ${{ env.SNAP_DIRECTORY }}/coverage ${{ env.SNAP_DIRECTORY }}/junit*.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
with:
check_name: "${{ inputs.snap-report-name }} Unit Test Results"
files: "packages/${{ inputs.snap-package-dir }}/**/junit-snap.xml"
- name: Publish Coverage to CodeCov
uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
with:
token: ${{ secrets.codecov-token }}
slug: hashgraph/hedera-metamask-snaps
directory: ${{ env.SNAP_DIRECTORY }}/coverage
- name: Publish Coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.codacy-project-token }}
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Typescript $(find '${{ env.SNAP_DIRECTORY }}' -name 'lcov.info' -printf '-r %p ')