Skip to content

Commit 5af8eac

Browse files
authored
Merge pull request #2 from sonatype-nexus-community/feat/adopt-community-standards
feat: adopt community standards
2 parents d14b306 + 38e1cba commit 5af8eac

13 files changed

+852
-318
lines changed

.circleci/config.yml

-125
This file was deleted.

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @madpah

.github/workflows/build.yaml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Build, Test & Validate
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
workflow_dispatch:
8+
schedule:
9+
# schedule weekly tests, since some dependencies are not intended to be pinned
10+
# this means: at 23:42 on Fridays
11+
- cron: '42 23 * * 5'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
OPEN_API_GENERATOR_VERSION: 'v7.9.0'
19+
PYTHON_VERSION_DEFAULT: '3.12'
20+
POETRY_VERSION: '1.8.1'
21+
22+
jobs:
23+
generate-library-code:
24+
name: Generate Library Code ${{ matrix.language }}
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
language: ['python', 'typescript']
29+
steps:
30+
- name: Checkout
31+
# see https://github.com/actions/checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Create Output Directory
35+
run: mkdir out/${{ matrix.language }}
36+
37+
- name: Run OpenAPI Generator
38+
uses: addnab/docker-run-action@v3
39+
with:
40+
image: openapitools/openapi-generator-cli:${{ env.OPEN_API_GENERATOR_VERSION }}
41+
options: -v ${{ github.workspace }}:/local
42+
run: /usr/local/bin/docker-entrypoint.sh batch --clean /local/${{ matrix.language }}.yaml
43+
44+
# - name: Copy our scripts across too
45+
# run: cp *.sh ./out/${{ matrix.language }}
46+
47+
- name: Save to Cache
48+
uses: actions/cache/save@v4
49+
with:
50+
path: out/${{ matrix.language }}
51+
key: '${{ matrix.language }}-${{ github.run_id }}'
52+
53+
# validate-go:
54+
# name: Validate Go Library
55+
# runs-on: ubuntu-latest
56+
# needs: generate-library-code
57+
58+
# steps:
59+
# - name: Setup Go
60+
# uses: actions/setup-go@v5
61+
# with:
62+
# go-version: 1.22
63+
64+
# - name: Get generated code from cache
65+
# uses: actions/cache/restore@v4
66+
# with:
67+
# path: out/go
68+
# key: 'go-${{ github.run_id }}'
69+
# fail-on-cache-miss: true
70+
71+
# - name: Build Go API Client
72+
# run: go build -v ./
73+
# working-directory: out/go
74+
75+
# - name: Install test dependencies & run generated tests
76+
# run: |
77+
# go get github.com/stretchr/testify/assert
78+
# go test -v ./test/
79+
# working-directory: out/go
80+
81+
validate-python:
82+
name: Validate Python Library
83+
runs-on: ubuntu-latest
84+
needs: generate-library-code
85+
86+
steps:
87+
- name: Set up Python
88+
uses: actions/setup-python@v5
89+
with:
90+
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
91+
92+
- name: Install poetry
93+
# see https://github.com/marketplace/actions/setup-poetry
94+
uses: Gr1N/setup-poetry@v9
95+
with:
96+
poetry-version: ${{ env.POETRY_VERSION }}
97+
98+
- name: Get generated code from cache
99+
uses: actions/cache/restore@v4
100+
with:
101+
path: out/python
102+
key: 'python-${{ github.run_id }}'
103+
fail-on-cache-miss: true
104+
105+
- name: Install dependencies
106+
run: poetry install --no-root
107+
working-directory: out/python
108+
109+
- name: Ensure build successful
110+
run: poetry build
111+
working-directory: out/python
112+
113+
- name: Run Tests
114+
run: |
115+
pip install -r test-requirements.txt
116+
poetry run pytest
117+
working-directory: out/python
118+
119+
validate-typescript:
120+
name: Validate Typescript Library
121+
runs-on: ubuntu-latest
122+
needs: generate-library-code
123+
124+
steps:
125+
- name: Setup Node
126+
uses: actions/setup-node@v4
127+
with:
128+
node-version: latest
129+
130+
- name: Get generated code from cache
131+
uses: actions/cache/restore@v4
132+
with:
133+
path: out/typescript
134+
key: 'typescript-${{ github.run_id }}'
135+
fail-on-cache-miss: true
136+
137+
- name: Build Typescript API Client
138+
run: npm i && npm run build
139+
working-directory: out/typescript

0 commit comments

Comments
 (0)