WIP: Updated multiple readmes and auto build scripts
This commit is contained in:
@@ -45,7 +45,7 @@ Python toolkit for secure, auditable, and automated airlock agent and policy man
|
|||||||
|
|
||||||
## 🧑💻 Requirements
|
## 🧑💻 Requirements
|
||||||
|
|
||||||
TBD
|
[airlock_libs](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/0.1.1)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
name: Build and Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-linux:
|
|
||||||
runs-on: debian-bookworm
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
repository: 'brotoskyj/AirlockLibs'
|
|
||||||
token: ${{RUNNER_TOKEN}}
|
|
||||||
- name: Install Rust + Python + maturin
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y python3 python3-pip curl node
|
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
||||||
source $HOME/.cargo/env
|
|
||||||
pip3 install maturin --break-system-packages
|
|
||||||
|
|
||||||
- name: Build Linux Wheel
|
|
||||||
run: |
|
|
||||||
source $HOME/.cargo/env
|
|
||||||
maturin build --release --interpreter python3
|
|
||||||
|
|
||||||
- name: Upload Linux wheel
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-linux
|
|
||||||
path: target/wheels/*.whl
|
|
||||||
|
|
||||||
build-windows:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Docker
|
|
||||||
run: |
|
|
||||||
sudo apt-get update && sudo apt-get install -y docker.io
|
|
||||||
|
|
||||||
- name: Build Windows Wheel with maturin in cross container
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $PWD:/project -w /project ghcr.io/cross-rs/x86_64-pc-windows-gnu \
|
|
||||||
bash -c "pip3 install maturin && maturin build --release --target x86_64-pc-windows-gnu"
|
|
||||||
|
|
||||||
- name: Upload Windows wheel
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-windows
|
|
||||||
path: target/wheels/*win_amd64.whl
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: [build-linux, build-windows]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-linux
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: wheel-windows
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
- name: Get Version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
version=$(grep '^version' Cargo.toml | head -n1 | cut -d'"' -f2)
|
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Generate changelog from commits
|
|
||||||
id: changelog
|
|
||||||
run: |
|
|
||||||
log=$(git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0)..HEAD)
|
|
||||||
echo "$log" > changes.md
|
|
||||||
echo "log<<EOF" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "$log" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Create Gitea Release
|
|
||||||
uses: https://gitea.com/actions/create-release@v1
|
|
||||||
with:
|
|
||||||
tag: v${{ steps.version.outputs.version }}
|
|
||||||
title: Release v${{ steps.version.outputs.version }}
|
|
||||||
note: ${{ steps.changelog.outputs.log }}
|
|
||||||
env:
|
|
||||||
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
|
||||||
|
|
||||||
- name: Upload release assets
|
|
||||||
uses: https://gitea.com/actions/upload-release-asset@v1
|
|
||||||
with:
|
|
||||||
tag: v${{ steps.version.outputs.version }}
|
|
||||||
file: dist/*.whl
|
|
||||||
env:
|
|
||||||
RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -17,7 +17,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ A Rust implementation of common Airlock API integrations for use in [AirlockTool
|
|||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
To install and use this library in a standalone Python script
|
To install and use this library in a standalone Python script
|
||||||
|
### Install Using pip
|
||||||
|
Follow the instructions [here](https://git.racooncity.org/brotoskyj/-/packages/pypi/airlock-libs/)
|
||||||
### Install Wheel
|
### Install Wheel
|
||||||
#### Linux
|
#### Linux
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ To install and use this library in a standalone Python script
|
|||||||
#### Windows
|
#### Windows
|
||||||
```powershell
|
```powershell
|
||||||
cd target/wheels
|
cd target/wheels
|
||||||
python3 -m pip install airlock_libs-<versionNumber>-cp313-windows
|
python3 -m pip install airlock_libs-<versionNumber>-cp313-win_amd64.whl
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -144,9 +144,9 @@ async fn history_logging(
|
|||||||
let parsed: Value = serde_json::from_str(headers_replace.as_str()).unwrap();
|
let parsed: Value = serde_json::from_str(headers_replace.as_str()).unwrap();
|
||||||
let mut header_map = HeaderMap::new();
|
let mut header_map = HeaderMap::new();
|
||||||
if let Some(obj) = parsed.as_object() {
|
if let Some(obj) = parsed.as_object() {
|
||||||
for (key, value) in obj {
|
for (_key, value) in obj {
|
||||||
if let Some(v) = value.as_str() {
|
if let Some(v) = value.as_str() {
|
||||||
let val = HeaderValue::from_str(v).unwrap();
|
let val = HeaderValue::from_str(v).unwrap();
|
||||||
header_map.insert(HeaderName::from_str("X-APIKey").unwrap(), val);
|
header_map.insert(HeaderName::from_str("X-APIKey").unwrap(), val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ async fn history_logging(
|
|||||||
.expect("Failed to retrieve response from API");
|
.expect("Failed to retrieve response from API");
|
||||||
return first_response;
|
return first_response;
|
||||||
}
|
}
|
||||||
Err(res) => {
|
Err(_res) => {
|
||||||
let failed_response: ApiResponse = ApiResponse {
|
let failed_response: ApiResponse = ApiResponse {
|
||||||
error: "Failed".to_string(),
|
error: "Failed".to_string(),
|
||||||
response: ExecHistories {
|
response: ExecHistories {
|
||||||
|
|||||||
Reference in New Issue
Block a user