Skip to content

Commit 9b962c1

Browse files
authored
chore(ci): Fix workflows (#655)
1 parent 0772805 commit 9b962c1

File tree

5 files changed

+391
-396
lines changed

5 files changed

+391
-396
lines changed
Lines changed: 8 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -1,251 +1,18 @@
11
name: "Build and Test Client"
22

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-
93
on:
104
pull_request:
115
push:
126
branches:
137
- main
148
- "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-
uses: bats-core/[email protected]
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
1529

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+
permissions: {}
16712

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
13+
jobs:
14+
build-and-test:
15+
uses: opentdf/web-sdk/.github/workflows/reusable_build-and-test.yaml@main
16+
secrets:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/deliver.yaml

Lines changed: 4 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -13,125 +13,11 @@ on:
1313
permissions: {}
1414

1515
jobs:
16-
deliver-ghp:
16+
deliver:
1717
permissions:
1818
contents: read
1919
packages: write
2020
pages: write
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- name: "Checkout repo"
25-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26-
with:
27-
persist-credentials: false
28-
29-
- name: "Setup node"
30-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
31-
with:
32-
node-version: "22"
33-
registry-url: https://npm.pkg.github.com
34-
35-
- name: "Check version number is same between tag, library, and/or release"
36-
id: check-version
37-
env:
38-
REF: ${{ github.ref }}
39-
run: |
40-
if [[ "$REF" = refs/heads/release/* ]]; then
41-
scripts/check-version-is.sh "${GITHUB_REF##*release/}"
42-
elif [[ "$REF" = refs/tags/sdk/v* ]]; then
43-
scripts/check-version-is.sh "${GITHUB_REF_NAME#sdk/v}"
44-
else
45-
scripts/check-version-is.sh
46-
fi
47-
48-
- name: "Output build metadata"
49-
id: guess-build-metadata
50-
run: |
51-
FULL_VERSION=$(.github/workflows/gh-semver.sh)
52-
DIST_TAG=$(.github/workflows/guess-dist-tag.sh)
53-
54-
echo "FULL_VERSION=$FULL_VERSION" >> "$GITHUB_OUTPUT"
55-
echo "DIST_TAG=$DIST_TAG" >> "$GITHUB_OUTPUT"
56-
57-
- name: "Run: make doc"
58-
run: |
59-
make doc
60-
61-
- name: "Echo info"
62-
env:
63-
DIST_TAG: ${{ steps.guess-build-metadata.outputs.DIST_TAG }}
64-
FULL_VERSION: ${{ steps.guess-build-metadata.outputs.FULL_VERSION }}
65-
run: |
66-
echo "::notice file=lib/package.json::Will be published to \
67-
[GitHub Packages](https://github.com/opentdf/web-sdk/pkgs/npm/client) \
68-
as $DIST_TAG \
69-
with version=[$FULL_VERSION]"
70-
71-
- name: "Deliver to GitHub Packages"
72-
env:
73-
DIST_TAG: ${{ steps.guess-build-metadata.outputs.DIST_TAG }}
74-
FULL_VERSION: ${{ steps.guess-build-metadata.outputs.FULL_VERSION }}
75-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
run: |
77-
bash scripts/deliver-to-npm-registry.sh "$FULL_VERSION" "$DIST_TAG"
78-
79-
- name: "Echo info to Run Summary"
80-
run: |
81-
{
82-
echo "- [Client Library](https://github.com/opentdf/web-sdk/pkgs/npm/client)"
83-
echo "- [Command Line Tool](https://github.com/opentdf/web-sdk/pkgs/npm/cli)"
84-
} >>"$GITHUB_STEP_SUMMARY"
85-
86-
- name: "Publish documentation to gh-pages"
87-
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
88-
with:
89-
branch: gh-pages
90-
folder: lib/dist/docs
91-
92-
deliver-npmjs:
93-
permissions:
94-
contents: read
95-
runs-on: ubuntu-latest
96-
steps:
97-
- name: "Checkout repo"
98-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99-
with:
100-
persist-credentials: false
101-
102-
- name: "Setup node"
103-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
104-
with:
105-
node-version: "22"
106-
registry-url: "https://registry.npmjs.org"
107-
108-
- name: "Run: make all"
109-
run: |
110-
make all
111-
112-
- name: "Output build metadata"
113-
id: guess-build-metadata
114-
run: |
115-
FULL_VERSION=$(.github/workflows/gh-semver.sh)
116-
DIST_TAG=$(.github/workflows/guess-dist-tag.sh)
117-
118-
echo "FULL_VERSION=$FULL_VERSION" >> "$GITHUB_OUTPUT"
119-
echo "DIST_TAG=$DIST_TAG" >> "$GITHUB_OUTPUT"
120-
121-
- name: "Deliver to npmjs"
122-
env:
123-
DIST_TAG: ${{ steps.guess-build-metadata.outputs.DIST_TAG }}
124-
FULL_VERSION: ${{ steps.guess-build-metadata.outputs.FULL_VERSION }}
125-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
126-
run: |
127-
bash scripts/deliver-to-npm-registry.sh "$FULL_VERSION" "$DIST_TAG"
128-
129-
- name: "Echo info to Run Summary"
130-
env:
131-
FULL_VERSION: ${{ steps.guess-build-metadata.outputs.FULL_VERSION }}
132-
run: |
133-
{
134-
echo "- [Client Library](https://www.npmjs.com/package/@opentdf/sdk/v/$FULL_VERSION)"
135-
echo "- [Command Line Tool](https://www.npmjs.com/package/@opentdf/ctl/v/$FULL_VERSION)"
136-
echo "- [unpkg](https://unpkg.com/browse/@opentdf/sdk@$FULL_VERSION)"
137-
} >>"$GITHUB_STEP_SUMMARY"
21+
uses: opentdf/web-sdk/.github/workflows/reusable_deliver.yaml@main
22+
secrets:
23+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)