-
Notifications
You must be signed in to change notification settings - Fork 19
ci for cedar-agent #35
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
Merged
Merged
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
96b628d
ci for cedar-agent
EliMoshkovich 5713c90
changes for ci
EliMoshkovich 8d156f2
build check
EliMoshkovich 62a9cf8
final - after check
EliMoshkovich f9b920e
timeout-minutes added
EliMoshkovich 57079ea
test with --locked
EliMoshkovich 901adc2
test with another rust build actions
EliMoshkovich 5125c4d
another check
EliMoshkovich 0268ccd
using another action to upload artifacts
EliMoshkovich 0cd6abe
final
EliMoshkovich f7373f0
cross-build-check
EliMoshkovich 2efccdc
build-cross-chek
EliMoshkovich 8f4752a
build-cross test
EliMoshkovich 7b26a18
build-cross test
EliMoshkovich 99475bb
Merge branch 'main' into PER-10368-cargo-cicd
EliMoshkovich 03e7f40
check with --locked
EliMoshkovich 975eab8
--locked removed
EliMoshkovich 606c24c
disabled macos
EliMoshkovich e2b2bec
final
EliMoshkovich 4ae94a6
final-2
EliMoshkovich ca72a8c
check with arm
EliMoshkovich 94e7857
check with arm
EliMoshkovich 76378b7
check with arm
EliMoshkovich 82ab866
check with arm compile
EliMoshkovich 5cd3897
check arm64
EliMoshkovich 2985fa5
check arm
EliMoshkovich 305d552
export added for link
EliMoshkovich 95a052e
check with anouther linker
EliMoshkovich 2c76256
check arm
EliMoshkovich 2e2971a
build with arm - final
EliMoshkovich 13a0444
cargo-update-locked-file
EliMoshkovich e1bcaca
pre-release
EliMoshkovich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| name: Cedar-agent cross-build and Docker Build | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| env: | ||
| # The project name specified in Cargo.toml | ||
| PROJECT_NAME: cedar-agent | ||
|
|
||
| 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 | ||
| - name: linux-arm64 | ||
| runner: ubuntu-latest | ||
| target: aarch64-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 | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: "${{ matrix.target }}" | ||
|
|
||
| - name: Setup Cache | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Update Cargo.toml version | ||
| run: | | ||
| if [[ "${{ matrix.runner }}" == "macos-latest" ]]; then | ||
| sed -i '' '/\[package\]/,/^version = /s/^version = .*/version = "${{ github.event.release.tag_name }}"/' Cargo.toml | ||
| cat Cargo.toml | ||
| fi | ||
| if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then | ||
| sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml | ||
| cat Cargo.toml | ||
| fi | ||
|
|
||
| - name: Prepare for ARM64 | ||
| if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y gcc-aarch64-linux-gnu | ||
|
|
||
| # Define the path to the Cargo config file | ||
| CARGO_CONFIG="$HOME/.cargo/config.toml" | ||
|
|
||
| # Check if the file exists; if not, create it | ||
| if [[ ! -f "$CARGO_CONFIG" ]]; then | ||
| mkdir -p "$HOME/.cargo" | ||
| touch "$CARGO_CONFIG" | ||
| fi | ||
|
|
||
| # Add the target configuration if it doesn't already exist | ||
| if ! grep -q "\[target.aarch64-unknown-linux-gnu\]" "$CARGO_CONFIG"; then | ||
| echo -e "\n[target.aarch64-unknown-linux-gnu]" >> "$CARGO_CONFIG" | ||
| echo 'linker = "aarch64-linux-gnu-gcc"' >> "$CARGO_CONFIG" | ||
| echo "Configuration added to $CARGO_CONFIG" | ||
| else | ||
| echo "Configuration already exists in $CARGO_CONFIG" | ||
| fi | ||
| cat $HOME/.cargo/config.toml | ||
|
|
||
| - name: Build Binary | ||
| run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error | ||
|
|
||
| - name: Dry run cargo publish | ||
| run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} | ||
|
|
||
| - name: Upload Binaries | ||
| uses: "taiki-e/upload-rust-binary-action@v1" | ||
| with: | ||
| bin: ${{ env.PROJECT_NAME }} | ||
| target: ${{ matrix.target }} | ||
| token: ${{ secrets.TOKEN_GITHUB }} | ||
|
|
||
| - name: Publish package to crates.io | ||
| run: cargo publish --token ${CRATES_TOKEN} --target ${{ matrix.target }} | ||
| 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 }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 --locked | ||
| run: cargo update --locked | ||
|
|
||
| - name: Run cargo test | ||
| run: cargo test | ||
|
|
||
| - name: Run cargo build | ||
| run: cargo build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.