Skip to content

Commit

Permalink
Merge pull request #2 from sonatype-nexus-community/feat/adopt-commun…
Browse files Browse the repository at this point in the history
…ity-standards

feat: adopt community standards
  • Loading branch information
madpah authored Nov 15, 2024
2 parents d14b306 + 38e1cba commit 5af8eac
Show file tree
Hide file tree
Showing 13 changed files with 852 additions and 318 deletions.
125 changes: 0 additions & 125 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @madpah
139 changes: 139 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Build, Test & Validate

on:
push:
branches: ['main']
pull_request:
workflow_dispatch:
schedule:
# schedule weekly tests, since some dependencies are not intended to be pinned
# this means: at 23:42 on Fridays
- cron: '42 23 * * 5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
OPEN_API_GENERATOR_VERSION: 'v7.9.0'
PYTHON_VERSION_DEFAULT: '3.12'
POETRY_VERSION: '1.8.1'

jobs:
generate-library-code:
name: Generate Library Code ${{ matrix.language }}
runs-on: ubuntu-latest
strategy:
matrix:
language: ['python', 'typescript']
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4

- name: Create Output Directory
run: mkdir out/${{ matrix.language }}

- name: Run OpenAPI Generator
uses: addnab/docker-run-action@v3
with:
image: openapitools/openapi-generator-cli:${{ env.OPEN_API_GENERATOR_VERSION }}
options: -v ${{ github.workspace }}:/local
run: /usr/local/bin/docker-entrypoint.sh batch --clean /local/${{ matrix.language }}.yaml

# - name: Copy our scripts across too
# run: cp *.sh ./out/${{ matrix.language }}

- name: Save to Cache
uses: actions/cache/save@v4
with:
path: out/${{ matrix.language }}
key: '${{ matrix.language }}-${{ github.run_id }}'

# validate-go:
# name: Validate Go Library
# runs-on: ubuntu-latest
# needs: generate-library-code

# steps:
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.22

# - name: Get generated code from cache
# uses: actions/cache/restore@v4
# with:
# path: out/go
# key: 'go-${{ github.run_id }}'
# fail-on-cache-miss: true

# - name: Build Go API Client
# run: go build -v ./
# working-directory: out/go

# - name: Install test dependencies & run generated tests
# run: |
# go get github.com/stretchr/testify/assert
# go test -v ./test/
# working-directory: out/go

validate-python:
name: Validate Python Library
runs-on: ubuntu-latest
needs: generate-library-code

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}

- name: Install poetry
# see https://github.com/marketplace/actions/setup-poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Get generated code from cache
uses: actions/cache/restore@v4
with:
path: out/python
key: 'python-${{ github.run_id }}'
fail-on-cache-miss: true

- name: Install dependencies
run: poetry install --no-root
working-directory: out/python

- name: Ensure build successful
run: poetry build
working-directory: out/python

- name: Run Tests
run: |
pip install -r test-requirements.txt
poetry run pytest
working-directory: out/python

validate-typescript:
name: Validate Typescript Library
runs-on: ubuntu-latest
needs: generate-library-code

steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest

- name: Get generated code from cache
uses: actions/cache/restore@v4
with:
path: out/typescript
key: 'typescript-${{ github.run_id }}'
fail-on-cache-miss: true

- name: Build Typescript API Client
run: npm i && npm run build
working-directory: out/typescript
Loading

0 comments on commit 5af8eac

Please sign in to comment.