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

ci for cedar-agent #35

Merged
merged 32 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
96b628d
ci for cedar-agent
EliMoshkovich Sep 27, 2024
5713c90
changes for ci
EliMoshkovich Sep 27, 2024
8d156f2
build check
EliMoshkovich Sep 27, 2024
62a9cf8
final - after check
EliMoshkovich Sep 27, 2024
f9b920e
timeout-minutes added
EliMoshkovich Sep 27, 2024
57079ea
test with --locked
EliMoshkovich Oct 1, 2024
901adc2
test with another rust build actions
EliMoshkovich Oct 2, 2024
5125c4d
another check
EliMoshkovich Oct 2, 2024
0268ccd
using another action to upload artifacts
EliMoshkovich Oct 2, 2024
0cd6abe
final
EliMoshkovich Oct 2, 2024
f7373f0
cross-build-check
EliMoshkovich Oct 3, 2024
2efccdc
build-cross-chek
EliMoshkovich Oct 3, 2024
8f4752a
build-cross test
EliMoshkovich Oct 3, 2024
7b26a18
build-cross test
EliMoshkovich Oct 3, 2024
99475bb
Merge branch 'main' into PER-10368-cargo-cicd
EliMoshkovich Oct 3, 2024
03e7f40
check with --locked
EliMoshkovich Oct 3, 2024
975eab8
--locked removed
EliMoshkovich Oct 3, 2024
606c24c
disabled macos
EliMoshkovich Oct 3, 2024
e2b2bec
final
EliMoshkovich Oct 3, 2024
4ae94a6
final-2
EliMoshkovich Oct 3, 2024
ca72a8c
check with arm
EliMoshkovich Oct 7, 2024
94e7857
check with arm
EliMoshkovich Oct 7, 2024
76378b7
check with arm
EliMoshkovich Oct 7, 2024
82ab866
check with arm compile
EliMoshkovich Oct 7, 2024
5cd3897
check arm64
EliMoshkovich Oct 7, 2024
2985fa5
check arm
EliMoshkovich Oct 7, 2024
305d552
export added for link
EliMoshkovich Oct 7, 2024
95a052e
check with anouther linker
EliMoshkovich Oct 7, 2024
2c76256
check arm
EliMoshkovich Oct 7, 2024
2e2971a
build with arm - final
EliMoshkovich Oct 7, 2024
13a0444
cargo-update-locked-file
EliMoshkovich Oct 8, 2024
e1bcaca
pre-release
EliMoshkovich Oct 8, 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
Prev Previous commit
Next Next commit
cross-build-check
EliMoshkovich committed Oct 3, 2024
commit f7373f03aa783044e9be034df68db186e690b472
159 changes: 81 additions & 78 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,97 @@
name: Cedar-agent and Docker Build
name: Cedar-agent cross-build and Docker Build

on:
pull_request:
branches:
- main
release:
types: [published]
on: push
# release:
# types: [published]

jobs:
# On PR: Run Cargo tests, build, and update
pr_checks:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Run cargo update
run: cargo update
env:
# The project name specified in Cargo.toml
PROJECT_NAME: cedar-agent

- name: Run cargo test
run: cargo test

- name: Run cargo build
run: cargo build

# On Release: Publish Cargo package, build and push Docker image
release:
if: github.event_name == 'release'
runs-on: ubuntu-latest
timeout-minutes: 70
jobs:
build-cross-package:
# Set the job to run on the platform specified by the matrix below
runs-on: ${{ matrix.runner }}

# Define the build matrix for cross-compilation
strategy:
matrix:
include:
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
# ------- Lets keep this commented out for now for future optional use
# - name: win-amd64
# runner: windows-latest
# target: x86_64-pc-windows-msvc
# - name: macos-amd64
# runner: macos-latest
# target: x86_64-apple-darwin
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin

steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
targets: "${{ matrix.target }}"

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Update Cargo.toml version
run: |
sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml
cat Cargo.toml
- name: Build Binary
run: cargo build --verbose --locked --release --target ${{ matrix.target }}

- name: Dry run cargo publish
run: cargo publish --dry-run --allow-dirty

- name: Publishing Rust build artifacts
uses: rust-build/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }}

- uses: taiki-e/upload-rust-binary-action@v1
with:
RUSTTARGET: x86_64-unknown-linux-musl
bin: cedar-agent-${{ github.event.release.tag_name }}
token: ${{ secrets.TOKEN_GITHUB }}

- name: Publish package to crates.io
run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# - name: Publish package to crates.io
# run: cargo publish --token ${CRATES_TOKEN}
# env:
# CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# docker-build-push:
# runs-on: ubuntu-latest
# timeout-minutes: 70
# needs: build-cross-package
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

# - name: Login to DockerHub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & Push cedar-agent
uses: docker/build-push-action@v4
with:
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=registry,ref=permitio/cedar-agent:latest
cache-to: type=inline
tags: |
permitio/cedar-agent:latest
permitio/cedar-agent:${{ github.event.release.tag_name }}
# - name: Build & Push cedar-agent
# uses: docker/build-push-action@v4
# with:
# file: Dockerfile
# platforms: linux/amd64,linux/arm64
# push: true
# cache-from: type=registry,ref=permitio/cedar-agent:latest
# cache-to: type=inline
# tags: |
# permitio/cedar-agent:latest
# permitio/cedar-agent:${{ github.event.release.tag_name }}
30 changes: 30 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Cedar-agent - PR test

on:
pull_request:
branches:
- main

jobs:
pr_checks:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Run cargo update
run: cargo update

- name: Run cargo test
run: cargo test

- name: Run cargo build
run: cargo build