forked from servo/mozjs
-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (98 loc) · 3.28 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository_owner }}/mozjs
MOZJS_ARCHIVE: libmozjs.tar.gz
jobs:
release-tag:
runs-on: ubuntu-latest
steps:
- id: tag-name
run: |
if [[ '${{ inputs.release-tag }}' != '' ]]; then
echo "RELEASE_TAG=${{ inputs.release-tag }}" >> ${GITHUB_OUTPUT}
elif [[ '${{ github.event_name }}' == 'release' ]]; then
echo "RELEASE_TAG=${{ github.ref_name }}" >> ${GITHUB_OUTPUT}
fi
outputs:
release-tag: ${{ steps.tag-name.outputs.RELEASE_TAG }}
mac:
strategy:
fail-fast: false
matrix:
features: ["--features streams"]
platform:
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-apple-darwin, os: macos-13 }
runs-on: ${{ matrix.platform.os }}
needs: release-tag
steps:
- uses: actions/checkout@v4
- name: Download prebuilt mozjs
run: |
curl -L https://github.com/${REPO}/releases/download/${{ needs.release-tag.outputs.release-tag }}/libmozjs-${{ matrix.platform.target }}.tar.gz -o libmozjs.tar.gz
- name: Build
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
linux:
runs-on: ubuntu-latest
needs: release-tag
strategy:
fail-fast: false
matrix:
features: ["--features streams"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Download prebuilt mozjs
run: |
curl -L https://github.com/${REPO}/releases/download/${{ needs.release-tag.outputs.release-tag }}/libmozjs-x86_64-unknown-linux-gnu.tar.gz -o libmozjs.tar.gz
- name: Build
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
windows:
runs-on: windows-latest
needs: release-tag
strategy:
fail-fast: false
matrix:
features: ["--features streams"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Download prebuilt mozjs
run: |
curl -L https://github.com/${{ github.repository_owner }}/mozjs/releases/download/${{ needs.release-tag.outputs.release-tag }}/libmozjs-x86_64-pc-windows-msvc.tar.gz -o libmozjs.tar.gz
- name: Build Windows
shell: cmd
run: |
cargo build --verbose ${{ matrix.features }}
cargo test --tests --examples --verbose ${{ matrix.features }}
build_result:
name: Result
runs-on: ubuntu-latest
needs:
["linux", "mac", "windows"]
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