|
1 | 1 | name: "Build and Test Client" |
2 | 2 |
|
3 | | -env: |
4 | | - do_sonarscan: >- |
5 | | - ${{ (github.event_name == 'push' || |
6 | | - github.event.pull_request.head.repo.full_name == github.repository) && |
7 | | - github.actor != 'dependabot[bot]' }} |
8 | | -
|
9 | 3 | on: |
10 | 4 | pull_request: |
11 | 5 | push: |
12 | 6 | branches: |
13 | 7 | - main |
14 | 8 | - "release/**" |
15 | | -jobs: |
16 | | - ccc: |
17 | | - runs-on: ubuntu-latest |
18 | | - defaults: |
19 | | - run: |
20 | | - working-directory: ./lib |
21 | | - timeout-minutes: 5 |
22 | | - steps: |
23 | | - - name: Conventional Commits Check |
24 | | - if: contains(fromJSON('["pull_request", "pull_request_target"]'), github.event_name) |
25 | | - id: conventional-commits |
26 | | - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 |
27 | | - env: |
28 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
29 | | - with: |
30 | | - # Types include: |
31 | | - # - fix: fixes |
32 | | - # - feat: features and enhancements |
33 | | - # - chore: non-feature or enhancement (i.e. docs, ci, linting, automated, etc) |
34 | | - types: | |
35 | | - fix |
36 | | - feat |
37 | | - chore |
38 | | - revert |
39 | | - # Scopes include: |
40 | | - # - sdk: changes to @opentdf/sdk (was lib) |
41 | | - # - cli: changes to @opentdf/ctl |
42 | | - # - ci: anything related to ci |
43 | | - # - tests: test only changes |
44 | | - # - docs: anything related solely to documentation |
45 | | - scopes: | |
46 | | - ci |
47 | | - cli |
48 | | - docs |
49 | | - sdk |
50 | | - tests |
51 | | -
|
52 | | - lib: |
53 | | - runs-on: ubuntu-latest |
54 | | - defaults: |
55 | | - run: |
56 | | - working-directory: ./lib |
57 | | - timeout-minutes: 5 |
58 | | - steps: |
59 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
60 | | - with: |
61 | | - fetch-depth: ${{ !fromJSON(env.do_sonarscan) && 1 || 0 }} |
62 | | - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0 |
63 | | - with: |
64 | | - node-version: '22' |
65 | | - cache: 'npm' |
66 | | - cache-dependency-path: './lib/package-lock.json' |
67 | | - - run: npm ci |
68 | | - - run: npm test |
69 | | - - uses: fingerprintjs/action-coverage-report-md@72dfb7de7581612640a8e599e918b2eda98f9bba #v2.0.1 |
70 | | - id: coverage-md |
71 | | - with: |
72 | | - srcBasePath: './' |
73 | | - textReportPath: './lib/coverage/coverage.txt' |
74 | | - - run: echo "${MARKDOWN_REPORT}" >>$GITHUB_STEP_SUMMARY |
75 | | - env: |
76 | | - MARKDOWN_REPORT: '${{ steps.coverage-md.outputs.markdownReport }}' |
77 | | - - run: npm audit --omit dev && npm audit --audit-level high --omit dev |
78 | | - - run: npm run license-check |
79 | | - - run: npm run lint |
80 | | - - run: npm pack |
81 | | - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 |
82 | | - with: |
83 | | - name: opentdf-sdk-lib |
84 | | - path: ./lib/opentdf-sdk-*.tgz |
85 | | - - name: SonarCloud Scan |
86 | | - if: fromJSON(env.do_sonarscan) |
87 | | - uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf #v5.2.0 |
88 | | - env: |
89 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
90 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
91 | | - |
92 | | - cli: |
93 | | - needs: |
94 | | - - lib |
95 | | - runs-on: ubuntu-latest |
96 | | - defaults: |
97 | | - run: |
98 | | - working-directory: ./cli |
99 | | - timeout-minutes: 5 |
100 | | - steps: |
101 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
102 | | - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0 |
103 | | - with: |
104 | | - node-version: '22' |
105 | | - cache: 'npm' |
106 | | - cache-dependency-path: './cli/package-lock.json' |
107 | | - - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e #v4.2.1 |
108 | | - with: |
109 | | - name: opentdf-sdk-lib |
110 | | - path: lib/ |
111 | | - - run: npm uninstall @opentdf/sdk && npm ci && npm i ../lib/opentdf-sdk-*.tgz |
112 | | - - run: npm test |
113 | | - - run: npm audit --omit dev && npm audit --audit-level high --omit dev |
114 | | - - run: npm run license-check |
115 | | - - run: npm run lint |
116 | | - - run: npm pack |
117 | | - - name: Setup Bats and bats libs |
118 | | - |
119 | | - - run: bats bin/opentdf.bats |
120 | | - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 |
121 | | - with: |
122 | | - name: opentdf-ctl |
123 | | - path: ./cli/opentdf-ctl-*.tgz |
124 | | - |
125 | | - web-app: |
126 | | - needs: |
127 | | - - lib |
128 | | - runs-on: ubuntu-22.04 # NOTE: Playwright not yet supported on 24.04 |
129 | | - defaults: |
130 | | - run: |
131 | | - working-directory: ./web-app |
132 | | - timeout-minutes: 5 |
133 | | - steps: |
134 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
135 | | - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0 |
136 | | - with: |
137 | | - node-version: '22' |
138 | | - cache: 'npm' |
139 | | - cache-dependency-path: './web-app/package-lock.json' |
140 | | - - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e #v4.2.1 |
141 | | - with: |
142 | | - name: opentdf-sdk-lib |
143 | | - path: lib/ |
144 | | - - run: npm uninstall @opentdf/sdk && npm ci && npm i ../lib/opentdf-sdk-*.tgz |
145 | | - - run: npm install |
146 | | - - run: npm audit --omit dev && npm audit --audit-level high --omit dev |
147 | | - - run: npm run license-check |
148 | | - - run: npm run lint |
149 | | - - run: npx playwright install |
150 | | - - run: npm test |
151 | | - - run: npm pack |
152 | 9 |
|
153 | | - scripts: |
154 | | - runs-on: ubuntu-latest |
155 | | - defaults: |
156 | | - run: |
157 | | - working-directory: .github/workflows |
158 | | - timeout-minutes: 5 |
159 | | - steps: |
160 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
161 | | - - name: 🦇🦇🦇🦇🦇🦇 |
162 | | - run: docker run --rm -v "$PWD:/mnt" --workdir "/mnt" bats/bats:1.11.0 *.bats |
163 | | - - name: 🦪 ✔ 🧼🧼🧼 |
164 | | - run: >- |
165 | | - docker run --rm -v "$PWD:/mnt" --workdir "/mnt" "koalaman/shellcheck:v0.10.0" |
166 | | - --color=always *.sh |
| 10 | +# Default empty permissions for all jobs |
| 11 | +# fix later, need to add permissions for every job in reusable_build-and-test.yaml |
| 12 | +# then add corresponding permissions to the build-and-test job below |
| 13 | +#permissions: {} |
167 | 14 |
|
168 | | - platform-roundtrip: |
169 | | - needs: |
170 | | - - cli |
171 | | - - lib |
172 | | - - web-app |
173 | | - runs-on: ubuntu-22.04 # NOTE: Playwright not yet supported on 24.04 |
174 | | - defaults: |
175 | | - run: |
176 | | - working-directory: .github/workflows/roundtrip |
177 | | - timeout-minutes: 45 |
178 | | - steps: |
179 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
180 | | - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e #v4.3.0 |
181 | | - with: |
182 | | - node-version: '22' |
183 | | - cache: 'npm' |
184 | | - cache-dependency-path: './web-app/package-lock.json' |
185 | | - - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e #v4.2.1 |
186 | | - with: |
187 | | - name: opentdf-sdk-lib |
188 | | - path: lib/ |
189 | | - - uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e #v4.2.1 |
190 | | - with: |
191 | | - name: opentdf-ctl |
192 | | - path: cli/ |
193 | | - - name: Git clone backend |
194 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 |
195 | | - with: |
196 | | - path: .github/workflows/roundtrip/platform |
197 | | - repository: opentdf/platform |
198 | | - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b #v5.4.0 |
199 | | - with: |
200 | | - go-version-file: .github/workflows/roundtrip/platform/service/go.mod |
201 | | - check-latest: false |
202 | | - cache-dependency-path: | |
203 | | - .github/workflows/roundtrip/platform/lib/fixtures/go.sum |
204 | | - .github/workflows/roundtrip/platform/lib/ocrypto/go.sum |
205 | | - .github/workflows/roundtrip/platform/protocol/go/go.sum |
206 | | - .github/workflows/roundtrip/platform/sdk/go.sum |
207 | | - .github/workflows/roundtrip/platform/service/go.sum |
208 | | - - run: find ./ -name go.mod |
209 | | - - name: go configure backend |
210 | | - run: |- |
211 | | - go work init |
212 | | - for x in platform/{protocol/go,lib/{fixtures,ocrypto},sdk,service}; do |
213 | | - go work use "$x" |
214 | | - done |
215 | | - - run: docker compose up -d --wait --wait-timeout 240 |
216 | | - - env: |
217 | | - PLAYWRIGHT_TESTS_TO_RUN: roundtrip |
218 | | - run: |- |
219 | | - ./wait-and-test.sh platform |
220 | | -
|
221 | | - platform-xtest: |
222 | | - needs: |
223 | | - - cli |
224 | | - - lib |
225 | | - uses: opentdf/tests/.github/workflows/xtest.yml@main |
226 | | - with: |
227 | | - focus-sdk: js |
228 | | - js-ref: ${{ github.ref }} latest lts |
229 | | - platform-ref: main lts |
230 | | - |
231 | | - ci: |
232 | | - needs: |
233 | | - - lib |
234 | | - - cli |
235 | | - - web-app |
236 | | - - scripts |
237 | | - - platform-xtest |
238 | | - runs-on: ubuntu-22.04 |
239 | | - if: ${{ !cancelled() }} |
240 | | - steps: |
241 | | - |
242 | | - - name: "All jobs succeeded" |
243 | | - id: success |
244 | | - if: ${{ contains(needs.*.result, 'success') }} |
245 | | - run: | |
246 | | - : |
247 | | -
|
248 | | - - name: "One or more jobs failed" |
249 | | - if: ${{ contains(needs.*.result, 'failure') }} |
250 | | - run: | |
251 | | - exit 1 |
| 15 | +jobs: |
| 16 | + build-and-test: |
| 17 | + uses: opentdf/web-sdk/.github/workflows/reusable_build-and-test.yaml@main |
| 18 | + secrets: |
| 19 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
0 commit comments