-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (91 loc) · 3.31 KB
/
Copy pathreusable-test-sdk.yaml
File metadata and controls
104 lines (91 loc) · 3.31 KB
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
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0
name: Test SDK
on:
workflow_call:
inputs:
dir_chart_version:
required: true
type: string
description: "The version of the dir Helm chart to install for the tests."
dirctl_image_tag:
required: true
type: string
description: "The tag of the dir-ctl Docker image to use in the tests."
sdk_ref:
required: false
type: string
description: "Git ref (branch, tag, or SHA) of agntcy/dir-sdk-javascript to test. When omitted, resolved automatically."
permissions:
id-token: write
contents: read
packages: read
jobs:
javascript:
name: JavaScript
runs-on: ubuntu-latest
steps:
# Cross-repo callers (e.g. agntcy/csit) need GITHUB_TOKEN with contents:read on this repo.
- name: Resolve SDK ref
id: sdk-ref
shell: bash
run: |
set -euo pipefail
if [ -n "${{ inputs.sdk_ref }}" ]; then
ref="${{ inputs.sdk_ref }}"
elif [ "${{ github.repository }}" = "agntcy/dir-sdk-javascript" ]; then
ref="${{ github.sha }}"
else
ref="main"
fi
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: agntcy/dir-sdk-javascript
ref: ${{ steps.sdk-ref.outputs.ref }}
fetch-depth: 0
- name: Login to ghcr.io
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: notused
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Task
uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Setup Node env
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24.x"
registry-url: https://registry.npmjs.org/
scope: "@agntcy"
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: tmp/artifacts
merge-multiple: true
- name: Cache npm dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: "~/.npm"
key: node-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node-${{ runner.os }}-
- name: Add dependencies for SDKs testing
env:
CLIENT_ID: "https://github.com/agntcy/dir-sdk-javascript/.github/workflows/reusable-test-sdk.yaml@${{ steps.sdk-ref.outputs.ref }}"
run: |
task deps:cicd:iodc-token-generation >> $GITHUB_ENV
- name: Test JavaScript SDK
env:
DIR_CHART_VERSION: ${{ inputs.dir_chart_version }}
DIRCTL_IMAGE_TAG: ${{ inputs.dirctl_image_tag }}
run: task test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
files: coverage/lcov.info
flags: integration
codecov_yml_path: codecov.yml
use_oidc: true
verbose: true