Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include an arm64 shared library in the ruby gem #1733

Merged
merged 24 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
25ccd61
Update nokogiri to version with support for apple silicon
jdeff Dec 1, 2023
551a7b5
Update gem dependencies to address spec failures running with Ruby 3
jdeff Dec 1, 2023
4941367
Require ActiveRecordAdapter from spec that uses it
jdeff Dec 1, 2023
df3e1ef
Add support for both x86_64 and arm64 linux architectures
jdeff Dec 1, 2023
391b139
Build both x86 and arm dynamic libraries for ruby
jdeff Dec 1, 2023
c1a839a
Use Ruby 2.6 as minimum tested version and 3.2 for all ruby-related t…
jdeff Dec 1, 2023
2fb55dc
Ensure the ruby libs are copied and available for testing
jdeff Dec 1, 2023
3cbf868
Bump solargraph and rubocop
jdeff Dec 5, 2023
1f71938
Update bundler to get rid of SPELL_CHECKERS warning
jdeff Dec 5, 2023
1776dae
Do not suggest extensions
jdeff Dec 6, 2023
2db2d5d
Simplify YARD docs for query method
jdeff Dec 6, 2023
80c388f
Must use Ruby 2.4 in order to build the docs on main
jdeff Dec 6, 2023
8b435fe
Must use Ruby 2.4 in order to build the docs on main
jdeff Dec 6, 2023
20fb79b
Use .ruby-version instead of hard-coding the current ruby version in …
jdeff Dec 6, 2023
84aaa5c
Merge origin/main
jdeff Jan 2, 2024
90a3eef
Clippy
gj Jan 7, 2024
03d90a2
Cargo fmt
gj Jan 7, 2024
7feebd1
Test
gj Jan 12, 2024
9e08687
Try building aarch64 first
gj Jan 12, 2024
1d3f776
Keep shuffling the deck chairs
gj Jan 12, 2024
6488f3c
Revert "Test"
gj Jan 13, 2024
f903c8a
Add 0.27.3 changelog
gj Jan 13, 2024
9df43fb
Bump version
gj Jan 13, 2024
db4b96e
Let's just release now instead
gj Jan 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/docs-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
if: steps.cache.outputs.cache-hit != 'true'
- name: Install yard
Expand Down Expand Up @@ -84,7 +83,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.79.1'
hugo-version: "0.79.1"
if: steps.cache.outputs.cache-hit != 'true'
- name: Build Hugo docs
env:
Expand Down Expand Up @@ -136,7 +135,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
ruby-version: "2.7"
working-directory: "languages/ruby"
if: steps.cache.outputs.cache-hit != 'true'
- name: Install yard
Expand Down Expand Up @@ -171,7 +170,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.79.1'
hugo-version: "0.79.1"
if: steps.cache.outputs.cache-hit != 'true'
- name: Build Hugo docs
env:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
- name: Install yard
run: gem install yard
Expand Down Expand Up @@ -61,7 +60,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.79.1'
hugo-version: "0.79.1"
- name: Get branch name (branch)
if: github.event_name != 'pull_request'
shell: bash
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
description: "docs s3 path (docs.oso.dev or docs-preview.oso.dev)"
oso_version:
description: "oso release to build docs for"
default: "0.27.2" # oso_version
default: "0.27.3" # oso_version
flask_oso_version:
description: "flask oso release to build docs for"
default: "0.27.1" # flask_oso_version
Expand Down Expand Up @@ -49,7 +49,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
- name: Install yard
run: gem install yard
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
- name: Set up ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
ruby-version: "3.2"
working-directory: "languages/ruby"
- run: gem push oso-oso-${{ github.event.inputs.version }}.gem
working-directory: "oso-ruby-${{ github.event.inputs.version }}"
Expand Down
41 changes: 26 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,42 @@ jobs:
profile: minimal
toolchain: 1.69.0
override: true
- name: Build release libraries
run: cargo build --release -p polar-c-api
- name: Build x86_64 release musl library
run: |
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="-C target-feature=-crt-static" cargo build --target x86_64-unknown-linux-musl --release -p polar-c-api
- name: Download cross
- name: Install cross
env:
GH_TOKEN: ${{ github.token }}
run: gh release download --repo cross-rs/cross --pattern 'cross-x86_64-unknown-linux-gnu\.tar\.gz'
run: |
gh release download --repo cross-rs/cross --pattern 'cross-x86_64-unknown-linux-gnu\.tar\.gz'
tar -xzvf cross-x86_64-unknown-linux-gnu.tar.gz
- name: Build aarch64 dynamic lib
run: |
rustup target add aarch64-unknown-linux-gnu
RUSTFLAGS="-C target-feature=-crt-static" ./cross build --target aarch64-unknown-linux-gnu --release -p polar-c-api
- name: Build aarch64 release musl library
run: |
rustup target add aarch64-unknown-linux-musl
tar -xzvf cross-x86_64-unknown-linux-gnu.tar.gz
RUSTFLAGS="-C target-feature=-crt-static" ./cross build --target aarch64-unknown-linux-musl --release -p polar-c-api
- name: Build x86_64 release libraries
run: cargo build --release -p polar-c-api
- name: Build x86_64 release musl library
run: |
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="-C target-feature=-crt-static" cargo build --target x86_64-unknown-linux-musl --release -p polar-c-api
- name: Rename static lib
run: mv target/release/libpolar.a target/libpolar-${{runner.os}}.a
- name: Rename x86_64 static lib
run: mv target/x86_64-unknown-linux-musl/release/libpolar.a target/libpolar-musl-x86_64.a
- name: Rename aarch64 static lib
run: mv target/aarch64-unknown-linux-musl/release/libpolar.a target/libpolar-musl-aarch64.a
- name: Rename x86_64 dynamic lib
run: mv target/release/libpolar.so target/libpolar-x86_64.so
- name: Rename aarch64 dynamic lib
run: mv target/aarch64-unknown-linux-gnu/release/libpolar.so target/libpolar-aarch64.so
- uses: actions/upload-artifact@v2
with:
name: oso_library
path: target/release/libpolar.so
path: |
target/libpolar-x86_64.so
target/libpolar-aarch64.so
- uses: actions/upload-artifact@v2
with:
name: oso_library
Expand Down Expand Up @@ -252,7 +263,7 @@ jobs:
- name: Copy libraries into resources.
run: |
mkdir -p languages/java/oso/src/main/resources/linux
cp -r oso_library/libpolar.so languages/java/oso/src/main/resources/linux/
cp -r oso_library/libpolar-x86_64.so languages/java/oso/src/main/resources/linux/libpolar.so
mkdir -p languages/java/oso/src/main/resources/macos
cp -r oso_library/libpolar-macOS-fat.dylib languages/java/oso/src/main/resources/macos/libpolar.dylib
mkdir -p languages/java/oso/src/main/resources/win
Expand Down Expand Up @@ -280,7 +291,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
- name: Set version env
id: version
Expand All @@ -292,7 +302,8 @@ jobs:
- name: Copy libraries into resources.
run: |
mkdir -p languages/ruby/ext/oso-oso/lib
cp -r oso_library/libpolar.so languages/ruby/ext/oso-oso/lib/
cp -r oso_library/libpolar-x86_64.so languages/ruby/ext/oso-oso/lib/
cp -r oso_library/libpolar-aarch64.so languages/ruby/ext/oso-oso/lib/
cp -r oso_library/libpolar-macOS-fat.dylib languages/ruby/ext/oso-oso/lib/libpolar.dylib
cp -r oso_library/polar.dll languages/ruby/ext/oso-oso/lib/
- name: Test
Expand Down Expand Up @@ -689,7 +700,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-11, windows-2019]
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2"]
steps:
- uses: actions/checkout@v2
- name: Set version env
Expand Down Expand Up @@ -805,7 +816,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
ruby-version: "2.7"
working-directory: "docs/examples/quickstart/ruby"
- name: Use Node.js 12
uses: actions/setup-node@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
- name: Lint Ruby code
working-directory: "languages/ruby"
Expand Down Expand Up @@ -214,7 +213,6 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '2.7'
working-directory: "languages/ruby"
- name: Test ruby
run: make ruby-test
Expand Down Expand Up @@ -350,8 +348,8 @@ jobs:
- name: Install Ruby + gems
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
working-directory: "languages/ruby"
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
Expand All @@ -362,6 +360,8 @@ jobs:
java-version: "11"
- name: Build python lib
run: make python-build
- name: Build ruby lib
run: make ruby-build
- name: Python test deps
run: make -C languages/python/oso test-requirements
- name: Build js lib
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ cython_debug/
# Java class files
*.class

.ruby-version
languages/java/oso/dependency-reduced-pom.xml
languages/java/oso/src/main/resources/*

Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ python-django-test: python-build python-django-build
python-sqlalchemy-test: python-build
$(MAKE) -C languages/python/sqlalchemy-oso test

ruby-build: rust-build
$(MAKE) -C languages/ruby copy_lib

ruby-test:
$(MAKE) -C languages/ruby test

Expand All @@ -55,7 +58,7 @@ java-test:
go-test: rust-build
$(MAKE) -C languages/go test

docs-test: python-build
docs-test: python-build ruby-build
$(MAKE) -C docs test

fmt: fmt-java fmt-rust fmt-python fmt-js fmt-go
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.27.2
0.27.3
21 changes: 21 additions & 0 deletions docs/content/any/project/changelogs/2024-01-12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Release 2024-01-12
menuTitle: 2024-01-12
any: true
description: >-
Changelog for Release 2024-01-12 (0.27.3) containing new features,
bug fixes, and more.
---

## `oso` 0.27.3

### Ruby

#### New features

##### Linux AArch64 support

You can now run the `oso-oso` gem in AArch64 Linux environments, including in
Docker on Apple silicon.

Thanks to [`@jdeff`](https://github.com/jdeff) for the contribution!
2 changes: 1 addition & 1 deletion docs/examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JS_DIR := $(OSO_ROOT)/languages/js
RUBY_DIR := $(OSO_ROOT)/languages/ruby

# Needed for tests
JAVA_PACKAGE_JAR_PATH := $(JAVA_DIR)/oso/target/oso-0.27.2.jar
JAVA_PACKAGE_JAR_PATH := $(JAVA_DIR)/oso/target/oso-0.27.3.jar

# Note: if you are using bundler in a sub-makefile (in a docs test for example),
# you need to add `unexport BUNDLE_GEMFILE` to that makefile. Otherwise this
Expand Down
2 changes: 1 addition & 1 deletion languages/java/oso/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.osohq</groupId>
<artifactId>oso</artifactId>
<!-- oso_version --><version>0.27.2</version>
<!-- oso_version --><version>0.27.3</version>

<distributionManagement>
<snapshotRepository>
Expand Down
2 changes: 1 addition & 1 deletion languages/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oso",
"version": "0.27.2",
"version": "0.27.3",
"description": "oso authorization library.",
"bin": "bin/repl.js",
"main": "dist/src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions languages/python/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
project = "oso"
copyright = "2020-2021 Oso Security, Inc"
author = "oso"
version = "0.27.2"
release = "0.27.2"
version = "0.27.3"
release = "0.27.3"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion languages/python/oso/oso/oso.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Core oso functionality"""

__version__ = "0.27.2"
__version__ = "0.27.3"

import os
from typing import Any, List, Set, Type
Expand Down
1 change: 1 addition & 0 deletions languages/ruby/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ vendor

# rspec failure tracking
.rspec_status
ext
Loading
Loading