Skip to content

Commit

Permalink
Initial commit; warning rename in progress
Browse files Browse the repository at this point in the history
We're in the process of renaming and reorganizing things before a 1.0
release.
  • Loading branch information
skeet70 committed Nov 14, 2023
0 parents commit 006f08b
Show file tree
Hide file tree
Showing 65 changed files with 9,997 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
Binary file added .github/9FA43559.asc.iron
Binary file not shown.
Binary file added .github/gradle.properties.iron
Binary file not shown.
23 changes: 23 additions & 0 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Bump Version

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

on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: New semver release version.

jobs:
bump:
uses: IronCoreLabs/workflows/.github/workflows/bump-version.yaml@bump-version-v1
with:
version: ${{ inputs.version }}
release_mode: prerelease
release_prereleases: false
secrets: inherit
21 changes: 21 additions & 0 deletions .github/workflows/rust-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Rust CI
on:
push:
branches:
- main
pull_request: null
workflow_dispatch: null
schedule:
- cron: 0 14 * * 1

jobs:
rust-ci:
uses: IronCoreLabs/workflows/.github/workflows/rust-ci.yaml@rust-ci-v1
with:
run_clippy: true
minimum_coverage: "50"
cargo_command_test_args: "--lib" # Doesn't generate or test Python/Kotlin
test_matrix_rust_version: '[""]'
test_matrix_build_only: "[false]"
test_matrix_include: "[]"
secrets: inherit
10 changes: 10 additions & 0 deletions .github/workflows/rust-daily.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Rust Daily
on:
schedule:
- cron: 0 14 * * 1-5
workflow_dispatch:

jobs:
rust-daily:
uses: IronCoreLabs/workflows/.github/workflows/rust-daily.yaml@rust-daily-v0
secrets: inherit
104 changes: 104 additions & 0 deletions .github/workflows/sdk-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Python/Kotlin CI
on:
pull_request:
workflow_dispatch:

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

jobs:
generate-cdylibs:
uses: IronCoreLabs/workflows/.github/workflows/rust-artifact.yaml@rust-artifact-v0
with:
# This should stay in sync with the `runs-on` from the other jobs in this file
os_matrix: '["buildjet-2vcpu-ubuntu-2204"]' # TODO: add back: "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", ["self-hosted", "macOS", "ARM64"]]'
build_profile: "release"
secrets: inherit

kotlin-test:
needs: generate-cdylibs
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
# This should stay in sync with the `os_matrix` above
runs-on: ["buildjet-2vcpu-ubuntu-2204"] # TODO: add back: "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", ["self-hosted", "macOS", "ARM64"] ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- uses: actions/download-artifact@v3
with:
name: ${{ join(matrix.runs-on) }}-
path: ${{ github.workspace }}/core/kotlin/src/main/resources/
- if: startsWith(matrix.runs-on, 'buildjet')
uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- if: startsWith(matrix.runs-on, 'macos')
uses: Swatinem/rust-cache@v2
with:
cache-provider: github
- name: Generate Kotlin files
run: cargo run --bin uniffi-bindgen generate --library resources/libcloaked_ai.* --language kotlin --out-dir kotlin
working-directory: core/kotlin/src/main
- name: Run Kotlin tests
run: ./gradlew test
working-directory: core/kotlin

python-test:
needs: generate-cdylibs
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
# This should stay in sync with the `os_matrix` above and the `runs-on` from the other jobs in this file
runs-on: ["buildjet-2vcpu-ubuntu-2204"] # TODO: add back: "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", ["self-hosted", "macOS", "ARM64"] ]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ join(matrix.runs-on) }}-
path: ${{ github.workspace }}/core/python/cloaked-ai/cloaked_ai
- if: startsWith(matrix.runs-on, 'buildjet')
uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- if: startsWith(matrix.runs-on, 'macos')
uses: Swatinem/rust-cache@v2
with:
cache-provider: github
- name: Generate Python files
run: cargo run --bin uniffi-bindgen generate --library libcloaked_ai.* --language python --out-dir .
working-directory: core/python/cloaked-ai/cloaked_ai
- name: Install hatch
if: matrix.runs-on == 'buildjet-4vcpu-ubuntu-2204-arm'
# The buildjet arm machine has a permissions error if we don't use sudo
run: sudo pipx install hatch
- name: Install hatch
if: matrix.runs-on != 'buildjet-4vcpu-ubuntu-2204-arm'
run: pipx install hatch
- name: Install Python test matrix
uses: actions/setup-python@v4
if: endsWith(matrix.runs-on, 'arm') != true && contains(matrix.runs-on, 'self-hosted') != true
with:
# there are no builds for arm linux at all, so we'll make do with the system ones
python-version: |
3.7
3.8
3.9
3.10
3.11
- name: Install Python test matrix (self-hosted)
if: contains(matrix.runs-on, 'self-hosted')
uses: actions/setup-python@v4
with:
# arm mac builds don't exist for pre-3.10
python-version: |
3.10
3.11
- name: Run Python tests
run: hatch run test:test
working-directory: core/python/cloaked-ai/cloaked_ai
106 changes: 106 additions & 0 deletions .github/workflows/sdk-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Python/Kotlin Release
on:
# https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
# The Bump Version workflow will make a Github release if it isn't a prerelease version
release:
types:
- created
workflow_dispatch:

jobs:
generate-cdylibs:
uses: IronCoreLabs/workflows/.github/workflows/rust-artifact.yaml@rust-artifact-v0
with:
os_matrix: '["buildjet-2vcpu-ubuntu-2204", "buildjet-4vcpu-ubuntu-2204-arm", "macos-12", ["self-hosted", "macOS", "ARM64"]]'
build_profile: "release"
secrets: inherit

kotlin-release:
needs: generate-cdylibs
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}/core/kotlin/src/main/resources/
- name: Rename directories
run: |
mv buildjet-2vcpu-ubuntu-2204- linux-x86-64
mv buildjet-4vcpu-ubuntu-2204-arm- linux-arm
mv macos-12- darwin-x86-64
mv self-hosted,macOS,ARM64- darwin-aarch64
working-directory: core/kotlin/src/main/resources/
- name: Decrypt GPG key and gradle.properties
uses: IronCoreLabs/ironhide-actions/decrypt@v3
with:
keys: ${{ secrets.IRONHIDE_KEYS }}
input: .github/9FA43559.asc.iron .github/gradle.properties.iron
- name: Move gradle properties and GPG key
run: |
mv .github/gradle.properties core/kotlin/gradle.properties
- name: Import GPG key
run: |
gpg --batch --import .github/9FA43559.asc
- name: Export GPG signing key
run: gpg --export-secret-keys > /tmp/9FA43559.asc
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- name: Generate Kotlin files
run: cargo run --bin uniffi-bindgen generate --library resources/linux-x86-64/libcloaked_ai.so --language kotlin --out-dir kotlin
working-directory: core/kotlin/src/main
- name: Publish
run: ./gradlew publish
working-directory: core/kotlin
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}

python-release:
needs: generate-cdylibs
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}/core/python/cloaked-ai
- name: Rename directories
run: |
mv buildjet-2vcpu-ubuntu-2204- linux-x86-64
mv buildjet-4vcpu-ubuntu-2204-arm- linux-arm
mv macos-12- darwin-x86-64
mv self-hosted,macOS,ARM64- darwin-aarch64
working-directory: core/python/cloaked-ai
- uses: Swatinem/rust-cache@v2
with:
cache-provider: buildjet
- name: Generate Python files
run: cargo run --bin uniffi-bindgen generate --library ../linux-x86-64/libcloaked_ai.so --language python --out-dir .
working-directory: core/python/cloaked-ai/cloaked_ai
- name: Install hatch
run: pipx install hatch
- name: Make wheels
run: |
archs="darwin-aarch64 darwin-x86-64 linux-arm linux-x86-64"
for arch in $archs; do
mv ../$arch/* ./
CDYLIB_PLATFORM=$arch hatch build -t wheel
rm libcloaked_ai.*
done
working-directory: core/python/cloaked-ai/cloaked_ai
- name: Release to PyPi
run: hatch publish --repo main --user __token__ --auth "${{ secrets.PYPI_TOKEN }}"
working-directory: core/python/cloaked-ai/cloaked_ai

mark-github-release:
if: github.event.release != null
needs: [kotlin-release, python-release]
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Mark GitHub release as not prerelease
env:
GH_TOKEN: ${{ secrets.WORKFLOW_PAT }}
run: gh release edit --tag "${{ github.event.release.tag_name }}" --prerelease=false "${{ github.event.release.name }}"
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Cargo
# will have compiled files and executables
/target/
**/out/

# These are backup files generated by rustfmt
**/*.rs.bk
.vscode

*.json
.direnv

!default_config/**

**/proptest-regressions/

# python build files
**/python/**/*.so
**/python/**/*.dylib
**/python/**/dist
**/__pycache__
**/.coverage

# python generated foreign module
**/cloaked_ai.py
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @IronCoreLabs/rust-dev
/.github/ @IronCoreLabs/ops
Loading

0 comments on commit 006f08b

Please sign in to comment.