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

Add prebuilt mozjs archive CI #454

Merged
merged 29 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6aef1eb
Add release CI pipeline
wusyong Feb 29, 2024
ad84256
Rename CI pipeline
wusyong Feb 29, 2024
c5bf7c2
Update CI trigger condition
wusyong Feb 29, 2024
d3e69ac
Merge CI into one file
wusyong Feb 29, 2024
7c1b25a
Add release steps
wusyong Feb 29, 2024
a29f3a0
Merge pull request #13 from wusyong/mozjs_release_patch
wusyong Mar 1, 2024
83793f4
Update widnow target arguments
wusyong Mar 1, 2024
d150367
Simplify release workflow
wusyong Mar 1, 2024
0737a22
Merge pull request #17 from wusyong/mozjs_patch
wusyong Mar 1, 2024
0b3f0b5
Add release check CI
wusyong Mar 2, 2024
9790c30
Update trigger condition and remove deps
wusyong Mar 4, 2024
2e0efed
Add CARGO_TARGET_DIR on Windows job
wusyong Mar 4, 2024
3c94562
Merge pull request #21 from wusyong/gh
wusyong Mar 4, 2024
a8370a3
Merge all jobs in release into one
wusyong Mar 4, 2024
2076043
Merge pull request #24 from wusyong/onejob
wusyong Mar 4, 2024
d84ff44
Check from artifact as well
wusyong Mar 4, 2024
3800976
Extract --features
wusyong Mar 4, 2024
dee33e6
Rename MOZJS_ARCHIVE path
wusyong Mar 4, 2024
72f6675
Merge pull request #27 from wusyong/ar
wusyong Mar 4, 2024
94afc62
Fix missed matrix.features
wusyong Mar 4, 2024
713e84e
Update release jobs
wusyong Mar 5, 2024
495e7e5
Merge pull request #29 from wusyong/rj
wusyong Mar 5, 2024
b154d0a
Update release tag name and check if exist before release
wusyong Mar 6, 2024
3241ac0
Merge pull request #31 from wusyong/ct
wusyong Mar 6, 2024
8d7ed20
Update release job to check remote tags
wusyong Mar 9, 2024
fb6869e
Simplify release job steps instead
wusyong Mar 9, 2024
a58bfe9
Revert latest commit
wusyong Mar 9, 2024
21f9113
Merge branch 'main' into mozjs_release
sagudev Mar 9, 2024
3809e36
Fix tag variable
wusyong Mar 9, 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
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

name: Version Release Check

on:
release:
types: [published]
workflow_call:
inputs:
release-tag:
required: true
type: string

env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
CARGO_INCREMENTAL: 0

jobs:
verify-archive:
strategy:
fail-fast: false
matrix:
platform:
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-apple-darwin, os: macos-13 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
runs-on: ${{ matrix.platform.os }}
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.ref_name || inputs.release-tag }}
MOZJS_ARCHIVE: libmozjs-${{ matrix.platform.target }}.tar.gz
steps:
- uses: actions/checkout@v4
- name: Download prebuilt mozjs from artifact
if: ${{ env.RELEASE_TAG == '' }}
uses: actions/download-artifact@v4
with:
name: libmozjs-${{ matrix.platform.target }}.tar.gz
- name: Download prebuilt mozjs from release
if: ${{ env.RELEASE_TAG != '' }}
run: |
curl -L https://github.com/${{ github.repository_owner }}/mozjs/releases/download/${{ env.RELEASE_TAG }}/libmozjs-${{ matrix.platform.target }}.tar.gz -o libmozjs-${{ matrix.platform.target }}.tar.gz
- name: Build
run: |
cargo build --verbose --features streams
cargo test --tests --examples --verbose --features streams
81 changes: 69 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
CARGO_INCREMENTAL: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MOZJS_CREATE_ARCHIVE: 1

jobs:
mac:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["debugmozjs", "streams"]
platform:
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-apple-darwin, os: macos-13 }
runs-on: ${{ matrix.platform.os }}
env:
RUSTC_WRAPPER: sccache
CCACHE: sccache
Expand All @@ -39,8 +44,15 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.3
- name: Build
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
cargo build --verbose --features ${{ matrix.features }}
cargo test --tests --examples --verbose --features ${{ matrix.features }}
- name: Upload artifact
if: ${{ contains(matrix.features, 'streams') }}
uses: actions/upload-artifact@v4
with:
path: ./target/libmozjs-${{ matrix.platform.target }}.tar.gz
name: libmozjs-${{ matrix.platform.target }}.tar.gz

linux:
env:
RUSTC_WRAPPER: "sccache"
Expand All @@ -50,7 +62,7 @@ jobs:
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["debugmozjs", "streams"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -61,21 +73,27 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.3
- name: Build
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
cargo build --verbose --features ${{ matrix.features }}
cargo test --tests --examples --verbose --features ${{ matrix.features }}
- name: Check wrappers integrity
# we generate wrappers only without debugmozjs
if: ${{ matrix.features == '' }}
if: ${{ matrix.features == 'streams' }}
run: |
bash ./mozjs/src/generate_wrappers.sh
git diff --quiet --exit-code
- name: Upload artifact
if: ${{ contains(matrix.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

windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
features: ["--features debugmozjs", ""]
features: ["debugmozjs", "streams"]
target: ["x86_64-pc-windows-msvc", "aarch64-pc-windows-msvc"]
env:
LINKER: "lld-link.exe"
Expand All @@ -98,12 +116,18 @@ jobs:
- name: Build Windows
shell: cmd
run: |
cargo build --verbose --target ${{ matrix.target }} ${{ matrix.features }}
cargo build --verbose --target ${{ matrix.target }} --features ${{ matrix.features }}
- name: Test Windows
if: ${{ !contains(matrix.target, 'aarch64') }}
shell: cmd
run: |
cargo test --tests --examples --verbose --target ${{ matrix.target }} ${{ matrix.features }}
cargo test --tests --examples --verbose --target ${{ matrix.target }} --features ${{ matrix.features }}
- name: Upload artifact
if: ${{ !contains(matrix.target, 'aarch64') && contains(matrix.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

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

publish-release:
name: Check version and publish release
runs-on: ubuntu-latest
needs:
["linux", "mac", "windows"]
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Publish release if tag doesn't exist
id: check-tag
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
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
if ! git show-ref --tags --verify --quiet "refs/tags/${RELEASE_TAG}" ; then
gh release create ${RELEASE_TAG} ./*.tar.gz
fi
echo "RELEASE_TAG=${RELEASE_TAG}" >> ${GITHUB_OUTPUT}
outputs:
release-tag: ${{ steps.check-tag.outputs.RELEASE_TAG }}

verify-release:
name: Verify release
needs: publish-release
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
uses: ./.github/workflows/release.yml
with:
release-tag: ${{ needs.publish-release.outputs.release-tag }}

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", "publish-release", "verify-release"]
if: ${{ always() }}
steps:
- name: Mark the job as successful
Expand All @@ -178,3 +234,4 @@ jobs:
- name: Mark the job as unsuccessful
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1

Loading