From 96b628dcbeb4fb7554c0fd8423a1efe071aee668 Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 27 Sep 2024 11:08:47 -0700 Subject: [PATCH 01/31] ci for cedar-agent --- .github/workflows/build_release.yml | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/build_release.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..c7aecd5 --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,86 @@ +name: Cedar-agent and Docker Build + +on: + pull_request: + branches: + - main + release: + types: [published] + +jobs: + # On PR: Run Cargo tests, build, and update + pr_checks: + #if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + 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 test + run: cargo test + + - name: Run cargo build + run: cargo build + + - name: Run cargo update --locked + run: cargo update --locked + + # On Release: Publish Cargo package, build and push Docker images + release: + #if: github.event_name == 'release' + runs-on: ubuntu-latest + 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: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + + - name: Update Cargo.toml version + run: | + #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"1.1.1\"/' Cargo.toml + cat Cargo.toml + + - name: Dry run cargo publish + run: cargo publish --dry-run + + # - name: Publish package to crates.io + # run: cargo publish + # env: + # CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + - name: Build & Push cedar-agent + uses: docker/build-push-action@v4 + with: + file: Dockerfile + platforms: linux/amd64,linux/arm64 + push: false + 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 }} From 5713c90b5e139686cb7f858dd1c5cd0e80ee530a Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 27 Sep 2024 11:21:34 -0700 Subject: [PATCH 02/31] changes for ci --- .github/workflows/build_release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index c7aecd5..b9862e0 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -29,8 +29,12 @@ jobs: - name: Run cargo build run: cargo build - - name: Run cargo update --locked - run: cargo update --locked + - name: Run cargo update + run: cargo update + #cargo generate-lockfile + #cargo update --offline + + #cargo update --locked # On Release: Publish Cargo package, build and push Docker images release: @@ -66,7 +70,7 @@ jobs: cat Cargo.toml - name: Dry run cargo publish - run: cargo publish --dry-run + run: cargo publish --dry-run --allow-dirty # - name: Publish package to crates.io # run: cargo publish From 8d156f25ed704223037edc3ffe3624657794b582 Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 27 Sep 2024 11:25:11 -0700 Subject: [PATCH 03/31] build check --- .github/workflows/build_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index b9862e0..21d63bf 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -87,4 +87,4 @@ jobs: cache-to: type=inline tags: | permitio/cedar-agent:latest - #permitio/cedar-agent:${{ github.event.release.tag_name }} + permitio/cedar-agent:1.1.1 From 62a9cf8f2303b7454e9c1943d68808ce181fb067 Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 27 Sep 2024 12:29:48 -0700 Subject: [PATCH 04/31] final - after check --- .github/workflows/build_release.yml | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 21d63bf..a990d53 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -10,7 +10,7 @@ on: jobs: # On PR: Run Cargo tests, build, and update pr_checks: - #if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - name: Checkout repository @@ -31,14 +31,10 @@ jobs: - name: Run cargo update run: cargo update - #cargo generate-lockfile - #cargo update --offline - #cargo update --locked - - # On Release: Publish Cargo package, build and push Docker images + # On Release: Publish Cargo package, build and push Docker image release: - #if: github.event_name == 'release' + if: github.event_name == 'release' runs-on: ubuntu-latest steps: - name: Checkout repository @@ -65,26 +61,27 @@ jobs: - name: Update Cargo.toml version run: | - #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml - sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"1.1.1\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml cat Cargo.toml - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty - # - name: Publish package to crates.io - # run: cargo publish - # env: - # CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Build & Push cedar-agent uses: docker/build-push-action@v4 with: file: Dockerfile platforms: linux/amd64,linux/arm64 - push: false + push: true cache-from: type=registry,ref=permitio/cedar-agent:latest cache-to: type=inline tags: | permitio/cedar-agent:latest - permitio/cedar-agent:1.1.1 + permitio/cedar-agent:${{ github.event.release.tag_name }} + + - name: Publish package to crates.io + run: cargo publish --token ${CRATES_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + From f9b920e8b3364704ef62bd55067ec39770f4e16b Mon Sep 17 00:00:00 2001 From: eli Date: Fri, 27 Sep 2024 12:32:04 -0700 Subject: [PATCH 05/31] timeout-minutes added --- .github/workflows/build_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index a990d53..00534bb 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -12,6 +12,7 @@ jobs: pr_checks: if: github.event_name == 'pull_request' runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout repository uses: actions/checkout@v3 @@ -36,6 +37,7 @@ jobs: release: if: github.event_name == 'release' runs-on: ubuntu-latest + timeout-minutes: 70 steps: - name: Checkout repository uses: actions/checkout@v3 From 57079eadd5d87ed8db89e1e7086b571d7b3be0a5 Mon Sep 17 00:00:00 2001 From: eli Date: Tue, 1 Oct 2024 13:55:32 -0700 Subject: [PATCH 06/31] test with --locked --- .github/workflows/build_release.yml | 11 ++++++++--- Cargo.toml | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 00534bb..ef3a32e 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -24,15 +24,15 @@ jobs: 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 - - name: Run cargo update - run: cargo update - # On Release: Publish Cargo package, build and push Docker image release: if: github.event_name == 'release' @@ -85,5 +85,10 @@ jobs: run: cargo publish --token ${CRATES_TOKEN} env: CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + - uses: taiki-e/upload-rust-binary-action@v1 + with: + bin: cedar-agent-${{ github.event.release.tag_name }}.crate + token: ${{ secrets.TOKEN_GITHUB }} diff --git a/Cargo.toml b/Cargo.toml index 22c0553..cfc120e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "cedar-agent" +# This update dynamically via CI version = "0.2.0" edition = "2021" license = "Apache-2.0" From 901adc21c57fbae59782d5a22ba7e4d29a93f0f6 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 2 Oct 2024 11:31:15 -0700 Subject: [PATCH 07/31] test with another rust build actions --- .github/workflows/build_release.yml | 56 ++++++++++++++++------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index ef3a32e..22b83fb 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -24,14 +24,22 @@ jobs: profile: minimal override: true - - name: Run cargo update --locked - run: cargo update --locked + # - name: Run cargo update --locked + # run: cargo update --locked - name: Run cargo test run: cargo test - - name: Run cargo build - run: cargo build + # - name: Run cargo build + # run: cargo build + + - name: Compile and release + uses: rust-build/rust-build.action@v1.4.5 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} + with: + RUSTTARGET: x86_64-unknown-linux-musl + # EXTRA_FILES: "README.md LICENSE" # On Release: Publish Cargo package, build and push Docker image release: @@ -69,26 +77,26 @@ jobs: - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty - - 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: Publish package to crates.io - run: cargo publish --token ${CRATES_TOKEN} - env: - CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_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: Publish package to crates.io + # run: cargo publish --token ${CRATES_TOKEN} + # env: + # CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - uses: taiki-e/upload-rust-binary-action@v1 - with: - bin: cedar-agent-${{ github.event.release.tag_name }}.crate - token: ${{ secrets.TOKEN_GITHUB }} + # - uses: taiki-e/upload-rust-binary-action@v1 + # with: + # bin: cedar-agent-${{ github.event.release.tag_name }}.crate + # token: ${{ secrets.TOKEN_GITHUB }} From 5125c4d29a792d3c0a2c5c2c06fa23b4e2f92560 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 2 Oct 2024 11:55:07 -0700 Subject: [PATCH 08/31] another check --- .github/workflows/build_release.yml | 19 ++++++++++--------- Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 22b83fb..f9e198c 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -17,18 +17,18 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true + # - 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 test + # run: cargo test # - name: Run cargo build # run: cargo build @@ -39,7 +39,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} with: RUSTTARGET: x86_64-unknown-linux-musl - # EXTRA_FILES: "README.md LICENSE" + ARCHIVE_TYPES: tar.gz + PRE_BUILD: "cargo test" # On Release: Publish Cargo package, build and push Docker image release: diff --git a/Cargo.toml b/Cargo.toml index cfc120e..baacba6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cedar-agent" # This update dynamically via CI -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "Apache-2.0" readme = "README.md" From 0268ccdb8d3f82cf1e2b1ecc4d6bf4bd573cbeb4 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 2 Oct 2024 12:45:49 -0700 Subject: [PATCH 09/31] using another action to upload artifacts --- .github/workflows/build_release.yml | 77 +++++++++++++---------------- Cargo.toml | 2 +- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index f9e198c..703b1ff 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -17,31 +17,22 @@ jobs: - 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: Set up Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true - # - name: Run cargo build - # run: cargo build + - name: Run cargo update --locked + run: cargo update --locked - - name: Compile and release - uses: rust-build/rust-build.action@v1.4.5 - env: - GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} - with: - RUSTTARGET: x86_64-unknown-linux-musl - ARCHIVE_TYPES: tar.gz - PRE_BUILD: "cargo test" + - 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' @@ -78,26 +69,26 @@ jobs: - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty - # - 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: Publishing Rust build artifacts + uses: rust-build/rust-build.action@v1.4.5 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} + with: + RUSTTARGET: x86_64-unknown-linux-musl - # - 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 }} - # - uses: taiki-e/upload-rust-binary-action@v1 - # with: - # bin: cedar-agent-${{ github.event.release.tag_name }}.crate - # token: ${{ secrets.TOKEN_GITHUB }} - - + - 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 }} diff --git a/Cargo.toml b/Cargo.toml index baacba6..cfc120e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cedar-agent" # This update dynamically via CI -version = "0.2.1" +version = "0.2.0" edition = "2021" license = "Apache-2.0" readme = "README.md" From 0cd6abe763d2fca3e6c931b644b573311e884824 Mon Sep 17 00:00:00 2001 From: eli Date: Wed, 2 Oct 2024 12:49:18 -0700 Subject: [PATCH 10/31] final --- .github/workflows/build_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 703b1ff..5ab759a 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -24,8 +24,8 @@ jobs: profile: minimal override: true - - name: Run cargo update --locked - run: cargo update --locked + - name: Run cargo update + run: cargo update - name: Run cargo test run: cargo test From f7373f03aa783044e9be034df68db186e690b472 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 10:35:49 -0700 Subject: [PATCH 11/31] cross-build-check --- .github/workflows/build_release.yml | 159 ++++++++++++++-------------- .github/workflows/pr_test.yml | 30 ++++++ 2 files changed, 111 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/pr_test.yml diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 5ab759a..f2c4af3 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -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/rust-build.action@v1.4.5 - 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 }} \ No newline at end of file diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml new file mode 100644 index 0000000..0903ff8 --- /dev/null +++ b/.github/workflows/pr_test.yml @@ -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 From 2efccdc09b62f0d1004c65a4226ccd69a72f06e8 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 10:38:24 -0700 Subject: [PATCH 12/31] build-cross-chek --- .github/workflows/build_release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index f2c4af3..74a6a3f 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -45,7 +45,8 @@ jobs: - name: Update Cargo.toml version run: | - sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml + #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"0.2.1\"/' Cargo.toml cat Cargo.toml - name: Build Binary From 8f4752aa5b83fe27a842754c5488c847e2ccadf1 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 10:40:02 -0700 Subject: [PATCH 13/31] build-cross test --- .github/workflows/build_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 74a6a3f..0e2db98 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -50,7 +50,7 @@ jobs: cat Cargo.toml - name: Build Binary - run: cargo build --verbose --locked --release --target ${{ matrix.target }} + 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 }} From 7b26a181179971405c53ff5e42a63ff8565f8e25 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 10:47:11 -0700 Subject: [PATCH 14/31] build-cross test --- .github/workflows/build_release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 0e2db98..720001b 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -46,8 +46,14 @@ jobs: - name: Update Cargo.toml version run: | #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml - sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"0.2.1\"/' Cargo.toml - cat Cargo.toml + if [[ "${{ matrix.runner }}" == "macos-latest" ]]; then + sed -i '' '/\[package\]/,/^version = /s/^version = .*/version = "0.2.1"/' Cargo.toml + cat Cargo.toml + fi + if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"0.2.1\"/' Cargo.toml + cat Cargo.toml + fi - name: Build Binary run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error From 03e7f40e593c7c55b7bf7430a09a3a89f87fb756 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 11:29:44 -0700 Subject: [PATCH 15/31] check with --locked --- .github/workflows/build_release.yml | 2 +- .github/workflows/pr_test.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 720001b..4f46961 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -56,7 +56,7 @@ jobs: fi - name: Build Binary - run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error + run: cargo build --verbose --locked --release --target ${{ matrix.target }} - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 0903ff8..299a569 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -20,8 +20,8 @@ jobs: profile: minimal override: true - - name: Run cargo update - run: cargo update + - name: Run cargo update --locked + run: cargo update --locked - name: Run cargo test run: cargo test From 975eab85f5a24850f6e41b0be2770db1cbb9242c Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 11:38:28 -0700 Subject: [PATCH 16/31] --locked removed --- .github/workflows/build_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 4f46961..720001b 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -56,7 +56,7 @@ jobs: fi - name: Build Binary - run: cargo build --verbose --locked --release --target ${{ matrix.target }} + 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 }} From 606c24c5a0be52548c0de981f29f2dc0a272a874 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 11:39:48 -0700 Subject: [PATCH 17/31] disabled macos --- .github/workflows/build_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 720001b..dc7aad5 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -27,9 +27,9 @@ jobs: # - name: macos-amd64 # runner: macos-latest # target: x86_64-apple-darwin - - name: macos-arm64 - runner: macos-latest - target: aarch64-apple-darwin + # - name: macos-arm64 + # runner: macos-latest + # target: aarch64-apple-darwin steps: - name: Checkout From e2b2bec048193488eec5871efb20031dcd3b3547 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 11:40:50 -0700 Subject: [PATCH 18/31] final --- .github/workflows/build_release.yml | 68 ++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index dc7aad5..bcb0aae 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -1,8 +1,8 @@ name: Cedar-agent cross-build and Docker Build -on: push - # release: - # types: [published] +on: + release: + types: [published] env: # The project name specified in Cargo.toml @@ -66,39 +66,39 @@ jobs: 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 + 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 QEMU + uses: docker/setup-qemu-action@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-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: 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 }} \ No newline at end of file + - 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 }} \ No newline at end of file From 4ae94a63a839da64a9f6f1822606994175e62d1f Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 3 Oct 2024 11:53:50 -0700 Subject: [PATCH 19/31] final-2 --- .github/workflows/build_release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index bcb0aae..7e22146 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -45,13 +45,12 @@ jobs: - name: Update Cargo.toml version run: | - #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml if [[ "${{ matrix.runner }}" == "macos-latest" ]]; then - sed -i '' '/\[package\]/,/^version = /s/^version = .*/version = "0.2.1"/' Cargo.toml + 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 = \"0.2.1\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml cat Cargo.toml fi From ca72a8cac0e624c4811e61e8f04534b5c21428a1 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 13:08:39 -0700 Subject: [PATCH 20/31] check with arm --- .github/workflows/build_release.yml | 87 ++++++++++++++++------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 7e22146..3d38775 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -1,8 +1,8 @@ name: Cedar-agent cross-build and Docker Build -on: - release: - types: [published] +on: push + # release: + # types: [published] env: # The project name specified in Cargo.toml @@ -20,6 +20,9 @@ jobs: - 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 @@ -56,48 +59,56 @@ jobs: - name: Build Binary run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error + + - name: Build ARM64 + if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --all --release --target=aarch64-unknown-linux-musl - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} - - uses: taiki-e/upload-rust-binary-action@v1 - with: - bin: cedar-agent-${{ github.event.release.tag_name }} - token: ${{ secrets.TOKEN_GITHUB }} + # - uses: taiki-e/upload-rust-binary-action@v1 + # with: + # 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 + # 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 QEMU + # uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-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: 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 }} \ No newline at end of file + # - 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 }} \ No newline at end of file From 94e7857660101636ea01eb80cbaf7178e2ebea64 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 13:11:06 -0700 Subject: [PATCH 21/31] check with arm --- .github/workflows/build_release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 3d38775..5a3f26e 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -53,7 +53,8 @@ jobs: cat Cargo.toml fi if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then - sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml + #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"1.1.1\"/' Cargo.toml cat Cargo.toml fi From 76378b7502e9fc9d7a6f607eed80176d9d378fd3 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 13:14:07 -0700 Subject: [PATCH 22/31] check with arm --- .github/workflows/build_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 5a3f26e..7806284 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -59,6 +59,7 @@ jobs: fi - name: Build Binary + if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error - name: Build ARM64 From 82ab866ab4d0789ee8c977df1a18c32f6bc2efaa Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 13:32:31 -0700 Subject: [PATCH 23/31] check with arm compile --- .github/workflows/build_release.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 7806284..81ca032 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -58,17 +58,23 @@ jobs: cat Cargo.toml fi + - name: Prepare for cross-compilation + if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + - name: Build Binary - if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} + # if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error - - name: Build ARM64 - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --all --release --target=aarch64-unknown-linux-musl + # - name: Build ARM64 + # if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + # uses: actions-rs/cargo@v1 + # with: + # use-cross: true + # command: build + # args: --all --release --target=aarch64-unknown-linux-musl - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} From 5cd3897637f276ea71cdf0e51575266b9e2fa60a Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 13:38:08 -0700 Subject: [PATCH 24/31] check arm64 --- .github/workflows/build_release.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 81ca032..f0f7fdc 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -58,23 +58,23 @@ jobs: cat Cargo.toml fi - - name: Prepare for cross-compilation + - 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 - name: Build Binary - # if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} + if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error - # - name: Build ARM64 - # if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} - # uses: actions-rs/cargo@v1 - # with: - # use-cross: true - # command: build - # args: --all --release --target=aarch64-unknown-linux-musl + - name: Build ARM64 + if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --all --release --target=aarch64-unknown-linux-musl - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} From 2985fa5fe50271ed391e37e9c8d4eb36c261e792 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 14:05:58 -0700 Subject: [PATCH 25/31] check arm --- .github/workflows/build_release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index f0f7fdc..047ad6c 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -39,9 +39,17 @@ jobs: uses: actions/checkout@v3 - name: Install Rust + if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} uses: dtolnay/rust-toolchain@stable with: targets: "${{ matrix.target }}" + + - uses: actions-rs/toolchain@v1 + if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + with: + toolchain: stable + target: aarch64-unknown-linux-gnu + override: true - name: Setup Cache uses: Swatinem/rust-cache@v2 From 305d552c52b8e3134c383e56c8686ce5a7439dda Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 14:53:22 -0700 Subject: [PATCH 26/31] export added for link --- .github/workflows/build_release.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 047ad6c..4562cb7 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -39,17 +39,9 @@ jobs: uses: actions/checkout@v3 - name: Install Rust - if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} uses: dtolnay/rust-toolchain@stable with: targets: "${{ matrix.target }}" - - - uses: actions-rs/toolchain@v1 - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} - with: - toolchain: stable - target: aarch64-unknown-linux-gnu - override: true - name: Setup Cache uses: Swatinem/rust-cache@v2 @@ -71,6 +63,8 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc + #export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc - name: Build Binary if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} From 95a052ef9992f5940a0bb634102266590f3cb71a Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 15:06:15 -0700 Subject: [PATCH 27/31] check with anouther linker --- .github/workflows/build_release.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 4562cb7..e4346de 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -63,8 +63,26 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu - export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc + #export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc #export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc + # 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 if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} From 2c76256ecc4acdfaa9682c150cf2fedec3231bf4 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 15:23:09 -0700 Subject: [PATCH 28/31] check arm --- .github/workflows/build_release.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index e4346de..50d157d 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -63,8 +63,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu - #export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc - #export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc + # Define the path to the Cargo config file CARGO_CONFIG="$HOME/.cargo/config.toml" @@ -85,20 +84,25 @@ jobs: cat $HOME/.cargo/config.toml - name: Build Binary - if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} + #if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error - - name: Build ARM64 - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --all --release --target=aarch64-unknown-linux-musl + # - name: Build ARM64 + # if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} + # uses: actions-rs/cargo@v1 + # with: + # use-cross: true + # command: build + # args: --all --release --target=aarch64-unknown-linux-musl - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} + - name: List files in target/release + run: | + echo "Listing files in target/release:" + ls -R target/release + # - uses: taiki-e/upload-rust-binary-action@v1 # with: # bin: cedar-agent-${{ github.event.release.tag_name }} From 2e2971ac848223d8258034de73cc9fd631a54233 Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 7 Oct 2024 16:02:55 -0700 Subject: [PATCH 29/31] build with arm - final --- .github/workflows/build_release.yml | 95 +++++++++++++---------------- 1 file changed, 41 insertions(+), 54 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 50d157d..324bf1a 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -1,8 +1,8 @@ name: Cedar-agent cross-build and Docker Build -on: push - # release: - # types: [published] +on: + release: + types: [published] env: # The project name specified in Cargo.toml @@ -53,8 +53,7 @@ jobs: cat Cargo.toml fi if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then - #sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml - sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"1.1.1\"/' Cargo.toml + sed -i '/\[package\]/,/^version = /s/^version = .*/version = \"${{ github.event.release.tag_name }}\"/' Cargo.toml cat Cargo.toml fi @@ -84,63 +83,51 @@ jobs: cat $HOME/.cargo/config.toml - name: Build Binary - #if: ${{ matrix.target != 'aarch64-unknown-linux-gnu' }} run: cargo build --verbose --release --target ${{ matrix.target }} # --locked have been removed to avoid error - - # - name: Build ARM64 - # if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} - # uses: actions-rs/cargo@v1 - # with: - # use-cross: true - # command: build - # args: --all --release --target=aarch64-unknown-linux-musl - name: Dry run cargo publish run: cargo publish --dry-run --allow-dirty --target ${{ matrix.target }} - - name: List files in target/release - run: | - echo "Listing files in target/release:" - ls -R target/release - - # - uses: taiki-e/upload-rust-binary-action@v1 - # with: - # bin: cedar-agent-${{ github.event.release.tag_name }} - # token: ${{ secrets.TOKEN_GITHUB }} + - 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} - # env: - # CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + - 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 + 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 QEMU + uses: docker/setup-qemu-action@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-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: 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 }} \ No newline at end of file + - 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 }} \ No newline at end of file From 13a0444ae487a83adb3a34c2697658164812ab73 Mon Sep 17 00:00:00 2001 From: eli Date: Tue, 8 Oct 2024 07:23:47 -0700 Subject: [PATCH 30/31] cargo-update-locked-file --- Cargo.lock | 69 ++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f743733..d64a5c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -248,9 +248,9 @@ checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cc" -version = "1.1.24" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "shlex", ] @@ -352,9 +352,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -362,9 +362,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -665,9 +665,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -689,33 +689,33 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -754,9 +754,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" @@ -1251,9 +1251,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] @@ -1272,12 +1272,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ordered-float" @@ -1383,12 +1380,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -1412,9 +1403,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] From e1bcaca16a0ee311b4b2a9f8ee4a9cb057a545dd Mon Sep 17 00:00:00 2001 From: eli Date: Tue, 8 Oct 2024 08:37:55 -0700 Subject: [PATCH 31/31] pre-release --- .github/workflows/build_release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 324bf1a..a898a03 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -120,7 +120,20 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build & Push cedar-agent + - name: Build & Push cedar-agent - (pre-release) + if: "github.event.release.prerelease" + 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:${{ github.event.release.tag_name }} + + - name: Build & Push cedar-agent - (official release) + if: "!github.event.release.prerelease" uses: docker/build-push-action@v4 with: file: Dockerfile @@ -130,4 +143,4 @@ jobs: cache-to: type=inline tags: | permitio/cedar-agent:latest - permitio/cedar-agent:${{ github.event.release.tag_name }} \ No newline at end of file + permitio/cedar-agent:${{ github.event.release.tag_name }}