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

Mozjs release patch #455

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
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
119 changes: 113 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
CARGO_INCREMENTAL: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MOZJS_CREATE_ARCHIVE: 1
REPO: ${{ github.repository_owner }}/mozjs

jobs:
mac:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["--features debugmozjs", "--features streams"]
platform:
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-apple-darwin, os: macos-13 }
runs-on: ${{ matrix.platform.os }}
needs: create-draft-release
env:
RUSTC_WRAPPER: sccache
CCACHE: sccache
SCCACHE_GHA_ENABLED: "true"
RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }}
steps:
- uses: actions/checkout@v4
- name: Install deps
Expand All @@ -41,16 +49,33 @@ jobs:
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
- name: Upload artifact
if: ${{ contains(matrix.features, '--features streams') }}
uses: actions/upload-artifact@v4
with:
path: ./target/libmozjs-${{ matrix.platform.target }}.tar.gz
name: libmozjs-${{ matrix.platform.target }}.tar.gz
- name: Upload release asset
if: ${{ contains(matrix.features, '--features streams') && needs.create-draft-release.outputs.release-id != '' }}
uses: actions/upload-release-asset@v1
with:
upload_url: https://uploads.github.com/repos/${{ github.repository_owner }}/mozjs/releases/${{ needs.create-draft-release.outputs.release-id }}/assets{?name,label}
asset_path: ./target/libmozjs-${{ matrix.platform.target }}.tar.gz
asset_name: libmozjs-${{ matrix.platform.target }}.tar.gz
asset_content_type: application/tar+gzip

linux:
env:
RUSTC_WRAPPER: "sccache"
CCACHE: sccache
SCCACHE_GHA_ENABLED: "true"
RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }}
runs-on: ubuntu-latest
needs: create-draft-release
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["--features debugmozjs", "--features streams"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -65,17 +90,32 @@ jobs:
cargo test --tests --examples --verbose ${{ matrix.features }}
- name: Check wrappers integrity
# we generate wrappers only without debugmozjs
if: ${{ matrix.features == '' }}
if: ${{ matrix.features == '--features streams' }}
run: |
bash ./mozjs/src/generate_wrappers.sh
git diff --quiet --exit-code
- name: Upload artifact
if: ${{ contains(matrix.features, '--features streams') }}
uses: actions/upload-artifact@v4
with:
path: ./target/libmozjs-x86_64-unknown-linux-gnu.tar.gz
name: libmozjs-x86_64-unknown-linux-gnu.tar.gz
- name: Upload release asset
if: ${{ contains(matrix.features, '--features streams') && needs.create-draft-release.outputs.release-id != '' }}
uses: actions/upload-release-asset@v1
with:
upload_url: https://uploads.github.com/repos/${{ github.repository_owner }}/mozjs/releases/${{ needs.create-draft-release.outputs.release-id }}/assets{?name,label}
asset_path: ./target/libmozjs-x86_64-unknown-linux-gnu.tar.gz
asset_name: libmozjs-x86_64-unknown-linux-gnu.tar.gz
asset_content_type: application/tar+gzip

windows:
runs-on: windows-latest
needs: create-draft-release
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["--features debugmozjs", "--features streams"]
target: ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"]
env:
LINKER: "lld-link.exe"
Expand All @@ -84,6 +124,7 @@ jobs:
MOZTOOLS_PATH: "${{ github.workspace }}\\target\\dependencies\\moztools-4.0"
CCACHE: sccache
SCCACHE_GHA_ENABLED: "true"
RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -104,6 +145,20 @@ jobs:
shell: cmd
run: |
cargo test --tests --examples --verbose --target ${{ matrix.target }} ${{ matrix.features }}
- name: Upload artifact
if: ${{ contains(matrix.features, '--features streams') }}
uses: actions/upload-artifact@v4
with:
path: ./target/${{ matrix.target }}/libmozjs-x86_64-pc-windows-msvc.tar.gz
name: libmozjs-x86_64-pc-windows-msvc.tar.gz
- name: Upload release asset
if: ${{ !contains(matrix.target, 'aarch64') && contains(matrix.features, '--features streams') && needs.create-draft-release.outputs.release-id != '' }}
uses: actions/upload-release-asset@v1
with:
upload_url: https://uploads.github.com/repos/${{ github.repository_owner }}/mozjs/releases/${{ needs.create-draft-release.outputs.release-id }}/assets{?name,label}
asset_path: ./target/${{ matrix.target }}/libmozjs-x86_64-pc-windows-msvc.tar.gz
asset_name: libmozjs-x86_64-pc-windows-msvc.tar.gz
asset_content_type: application/tar+gzip

android:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -165,11 +220,63 @@ jobs:
run: |
git diff --staged --no-ext-diff --quiet --exit-code

create-draft-release:
runs-on: ubuntu-latest
steps:
- name: Create draft release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: create-release
run: |
NIGHTLY_TAG=$(date "+%F")
RELEASE_URL=$(gh release create "${NIGHTLY_TAG}" \
--draft \
--title "${NIGHTLY_TAG}" \
--notes 'Version release based on servo/mozjs@${{ github.sha }}' \
--repo ${REPO})
TEMP_TAG=$(basename "$RELEASE_URL")
RELEASE_ID=$( \
gh api -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${REPO}/releases/tags/${TEMP_TAG}" \
| jq '.id' \
)
echo "RELEASE_ID=${RELEASE_ID}" >> ${GITHUB_OUTPUT}
outputs:
release-id: ${{ steps.create-release.outputs.RELEASE_ID }}

publish-release:
name: Publish release
runs-on: ubuntu-latest
needs:
["create-draft-release", "mac", "linux", "windows"]
env:
RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }}
steps:
- name: Publish as latest (success)
if: ${{ needs.create-draft-release.outputs.release-id != '' && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: |
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${REPO}/releases/${RELEASE_ID} \
-F draft=false
- name: Publish as latest (failure)
if: ${{ needs.create-draft-release.outputs.release-id != '' && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
run: |
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${REPO}/releases/${RELEASE_ID} \
-F prerelease=true -F draft=false
exit 1

build_result:
name: Result
runs-on: ubuntu-latest
needs:
["android", "linux", "linux-cross-compile", "mac", "windows", "integrity"]
["android", "linux", "linux-cross-compile", "mac", "windows", "integrity", "create-draft-release", "publish-release"]
if: ${{ always() }}
steps:
- name: Mark the job as successful
Expand Down
Loading