-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate attestation for all artifacts (#510)
* Generate attestation for all artifacts Signed-off-by: sagudev <[email protected]> * add result in main Signed-off-by: sagudev <[email protected]> * fix ohos arti Signed-off-by: sagudev <[email protected]> * bump mozjs-sys version Signed-off-by: sagudev <[email protected]> --------- Signed-off-by: sagudev <[email protected]>
- Loading branch information
Showing
4 changed files
with
79 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,15 +1,11 @@ | ||
name: Rust | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
merge_group: | ||
types: [checks_requested] | ||
schedule: | ||
# Runs at 03:30, every Saturday | ||
- cron: "30 3 * * 6" | ||
workflow_call: | ||
inputs: | ||
release: | ||
required: true | ||
type: boolean | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
|
@@ -46,6 +42,13 @@ jobs: | |
run: | | ||
cargo build --verbose --features ${{ matrix.features }} | ||
cargo test --tests --examples --verbose --features ${{ matrix.features }} | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
if: ${{ inputs.release && contains(matrix.features, 'streams') }} | ||
with: | ||
subject-path: ./target/libmozjs-${{ matrix.platform.target }}.tar.gz | ||
|
||
- name: Upload artifact | ||
if: ${{ contains(matrix.features, 'streams') }} | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -81,6 +84,13 @@ jobs: | |
run: | | ||
bash ./mozjs/src/generate_wrappers.sh | ||
git diff --quiet --exit-code | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
if: ${{ inputs.release && contains(matrix.features, 'streams') }} | ||
with: | ||
subject-path: ./target/libmozjs-x86_64-unknown-linux-gnu.tar.gz | ||
|
||
- name: Upload artifact | ||
if: ${{ contains(matrix.features, 'streams') }} | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -122,6 +132,13 @@ jobs: | |
shell: cmd | ||
run: | | ||
cargo test --tests --examples --verbose --target ${{ matrix.target }} --features ${{ matrix.features }} | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
if: ${{ inputs.release && !contains(matrix.target, 'aarch64') && contains(matrix.features, 'streams') }} | ||
with: | ||
subject-path: ./target/${{ matrix.target }}/libmozjs-x86_64-pc-windows-msvc.tar.gz | ||
|
||
- name: Upload artifact | ||
if: ${{ !contains(matrix.target, 'aarch64') && contains(matrix.features, 'streams') }} | ||
uses: actions/upload-artifact@v4 | ||
|
@@ -149,39 +166,11 @@ jobs: | |
./android-build cargo build --target="armv7-linux-androideabi" | ||
ohos: | ||
name: "OpenHarmony build" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: [ 'aarch64-unknown-linux-ohos', 'x86_64-unknown-linux-ohos' ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup OpenHarmony SDK | ||
id: setup_sdk | ||
uses: openharmony-rs/[email protected] | ||
with: | ||
version: "4.1" | ||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: ${{ matrix.target }} | ||
- name: Build (arch ${{ matrix.target }} ) | ||
env: | ||
OHOS_SDK_NATIVE: ${{ steps.setup_sdk.outputs.ohos_sdk_native }} | ||
run: | | ||
./ohos-build cargo build --target="${{ matrix.target }}" | ||
ohos-release: | ||
name: "OpenHarmony release artifact" | ||
name: "OpenHarmony" | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
attestations: write | ||
strategy: | ||
matrix: | ||
target: [ 'aarch64-unknown-linux-ohos', 'x86_64-unknown-linux-ohos' ] | ||
target: ["aarch64-unknown-linux-ohos", "x86_64-unknown-linux-ohos"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup OpenHarmony SDK | ||
|
@@ -197,11 +186,12 @@ jobs: | |
env: | ||
OHOS_SDK_NATIVE: ${{ steps.setup_sdk.outputs.ohos_sdk_native }} | ||
run: | | ||
./ohos-build cargo build --release --target="${{ matrix.target }}" | ||
./ohos-build cargo build --target="${{ matrix.target }}" --features "streams" | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v1 | ||
if: ${{ inputs.release }} | ||
with: | ||
subject-path: './target/libmozjs-${{ matrix.target }}.tar.gz' | ||
subject-path: "./target/libmozjs-${{ matrix.target }}.tar.gz" | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -257,7 +247,7 @@ jobs: | |
publish-release: | ||
name: Check version and publish release | ||
runs-on: ubuntu-latest | ||
needs: ["linux", "mac", "windows", "ohos-release"] | ||
needs: ["linux", "mac", "windows", "ohos"] | ||
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -266,7 +256,7 @@ jobs: | |
merge-multiple: true | ||
- name: Publish release if tag doesn't exist | ||
id: check-tag | ||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} | ||
if: ${{ inputs.release }} | ||
run: | | ||
RELEASE_TAG=mozjs-sys-v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "mozjs_sys") | .version') | ||
git fetch --tags --quiet | ||
|
@@ -281,7 +271,7 @@ jobs: | |
name: Verify release | ||
needs: publish-release | ||
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | ||
uses: ./.github/workflows/release.yml | ||
uses: ./.github/workflows/release-check.yml | ||
with: | ||
release-tag: ${{ needs.publish-release.outputs.release-tag }} | ||
|
||
|
This file contains 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,44 @@ | ||
name: Rust | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
merge_group: | ||
types: [checks_requested] | ||
schedule: | ||
# Runs at 03:30, every Saturday | ||
- cron: "30 3 * * 6" | ||
|
||
# dispatches build workflow with different permissions | ||
jobs: | ||
elevated: | ||
if: ${{ github.event_name == 'push' }} | ||
permissions: | ||
contents: write | ||
id-token: write | ||
attestations: write | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
release: true | ||
secrets: inherit | ||
normal: | ||
if: ${{ github.event_name != 'push' }} | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
release: false | ||
secrets: inherit | ||
|
||
build_result: | ||
name: Result | ||
runs-on: ubuntu-latest | ||
needs: ["elevated", "normal"] | ||
if: ${{ always() }} | ||
steps: | ||
- name: Mark the job as successful | ||
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | ||
run: exit 0 | ||
- name: Mark the job as unsuccessful | ||
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | ||
run: exit 1 |
File renamed without changes.
This file contains 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