Skip to content

Commit

Permalink
Merge branch 'validate_schema' of https://github.com/aadityasinha-dot…
Browse files Browse the repository at this point in the history
…com/zowe-client-python-sdk into validate_schema
  • Loading branch information
aadityasinha-dotcom committed Nov 22, 2023
2 parents 8b14be9 + 3e39549 commit ae8f4d6
Show file tree
Hide file tree
Showing 21 changed files with 1,380 additions and 297 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/dev-release.yaml.old

This file was deleted.

66 changes: 33 additions & 33 deletions .github/workflows/sdk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,41 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
coverage run -m pytest ./tests/unit
- name: Generate a coverage xml file
run: |
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.python-version == '3.11' }}
with:
directory: ./
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
coverage run -m pytest ./tests/unit
- name: Generate a coverage xml file
run: |
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ matrix.python-version == '3.12' }}
with:
directory: ./
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
verbose: true
75 changes: 75 additions & 0 deletions .github/workflows/sdk-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Zowe SDK Release

on:
workflow_dispatch:
inputs:
version:
description: Update project version before publish
required: false
type: string
dry-run:
description: Dry run mode
required: false
type: boolean

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Update version
id: update-version
shell: python
run: |
import os, sys
sys.path.append("src")
from _version import __version__
new_version = "${{ inputs.version }}"
if new_version:
with open("src/_version.py", 'w') as f:
f.write("__version__ = \"" + new_version + "\"\n")
else:
new_version = __version__
with open(os.environ["GITHUB_OUTPUT"], 'a') as f:
print("version=" + ("-".join(new_version.rsplit(".", 1)) if new_version.count(".") > 2 else new_version), file=f)
- name: Update version (cargo)
run: cargo install cargo-edit && cargo set-version ${{ steps.update-version.outputs.version }}
working-directory: src/secrets

- name: Update version (git)
run: git add src/_version.py src/secrets/Cargo.*

- name: Build wheels
run: bash build.sh

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/

- uses: zowe-actions/octorelease@v1
env:
GIT_COMMITTER_NAME: ${{ secrets.ZOWE_ROBOT_USER }}
GIT_COMMITTER_EMAIL: ${{ secrets.ZOWE_ROBOT_EMAIL }}
GIT_CREDENTIALS: x-access-token:${{ secrets.ZOWE_ROBOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_ROBOT_TOKEN }}
with:
dry-run: ${{ inputs.dry-run }}
new-version: ${{ steps.update-version.outputs.version }}
146 changes: 146 additions & 0 deletions .github/workflows/secrets-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# This file is autogenerated by maturin v1.3.1
# To update, run
#
# maturin generate-ci github
#
name: Secrets SDK CI

on:
push:
branches: ["**"]
paths:
- "src/secrets/**"
- ".github/workflows/secrets-sdk.yml"
tags: ["**"]
pull_request:
paths:
- "src/secrets/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set environment variables
run: src/secrets/scripts/configure-cross.sh ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: "true"
manylinux: auto
docker-options: -e PKG_CONFIG_SYSROOT_DIR -e PKG_CONFIG_PATH
working-directory: src/secrets
before-script-linux: |
if command -v yum &> /dev/null; then
yum update -y && yum install -y libsecret-devel.${{ env.CROSS_DEB_ARCH }} pkgconfig
else
dpkg --add-architecture ${{ env.CROSS_DEB_ARCH }}
sed -i "s/deb /deb [arch=amd64] /g" /etc/apt/sources.list
echo "deb [arch=${{ env.CROSS_DEB_ARCH }}] http://ports.ubuntu.com/ubuntu-ports/ jammy main universe" >> /etc/apt/sources.list
echo "deb [arch=${{ env.CROSS_DEB_ARCH }}] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main universe" >> /etc/apt/sources.list
apt-get update && apt-get install -y libsecret-1-dev:${{ env.CROSS_DEB_ARCH }} pkg-config
fi
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/secrets/dist

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86, aarch64]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
if: ${{ matrix.target != 'aarch64' }}
with:
python-version: "3.10"
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: "true"
working-directory: src/secrets
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/secrets/dist

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: "true"
working-directory: src/secrets
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/secrets/dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
working-directory: src/secrets
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: src/secrets/dist

release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_ROBOT_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing *
12 changes: 7 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"rust-analyzer.linkedProjects": ["./src/secrets/Cargo.toml"],
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
},
"python.testing.pytestArgs": ["tests"],
Expand Down
Loading

0 comments on commit ae8f4d6

Please sign in to comment.