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 build for linux-musl target #3754

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ jobs:
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-x64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-musl
packages: musl-tools
features: vendored
- target: x86_64-apple-darwin
os: macos-latest
build-name: relay
Expand Down Expand Up @@ -120,11 +126,14 @@ jobs:
run: yarn gulp setCompilerMainVersion
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
- name: Install packages
if: matrix.target.os == 'ubuntu-latest' && matrix.target.packages
run: sudo apt install ${{ matrix.target.packages }} -y
- uses: actions-rs/cargo@v1
with:
command: build
# add --locked back when we have a better way to ensure it's up to date
args: --manifest-path=compiler/Cargo.toml --release --target ${{ matrix.target.target }}
args: --manifest-path=compiler/Cargo.toml --release --target ${{ matrix.target.target }} ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.target.artifact-name }}
Expand All @@ -149,6 +158,11 @@ jobs:
with:
name: relay-compiler-linux-x64
path: artifacts/linux-x64
- name: Download artifact relay-compiler-linux-musl
uses: actions/download-artifact@v2
with:
name: relay-compiler-linux-musl
path: artifacts/linux-musl
- name: Download artifact relay-compiler-macos-x64
uses: actions/download-artifact@v2
with:
Expand All @@ -168,6 +182,7 @@ jobs:
working-directory: artifacts
run: |
chmod +x linux-x64/relay
chmod +x linux-musl/relay
chmod +x macos-x64/relay
chmod +x macos-arm64/relay

Expand Down
11 changes: 11 additions & 0 deletions compiler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions compiler/crates/persist-query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ serde = { version = "1.0.126", features = ["derive", "rc"] }
serde_json = { version = "1.0.64", features = ["float_roundtrip", "unbounded_depth"] }
thiserror = "1.0.29"
url = "2.2.2"

[features]
# Force openssl-sys to staticly link in the openssl library. Necessary when
# cross compiling to x86_64-unknown-linux-musl.
vendored = ["hyper-tls/vendored"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"cosmiconfig": "^5.0.5",
"cross-env": "^7.0.2",
"del": "6.0.0",
"detect-libc": "^1.0.3",
"eslint": "5.4.0",
"eslint-config-fbjs": "2.1.0",
"eslint-plugin-babel": "5.1.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/relay-compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
'use strict';

const path = require('path');
const { isNonGlibcLinux } = require('detect-libc');

let binary;
if (process.platform === 'darwin' && process.arch === 'x64') {
binary = path.join(__dirname, 'macos-x64', 'relay');
} else if (process.platform === 'darwin' && process.arch === 'arm64') {
binary = path.join(__dirname, 'macos-arm64', 'relay');
} else if (process.platform === 'linux' && isNonGlibcLinux) {
binary = path.join(__dirname, 'linux-musl', 'relay');
} else if (process.platform === 'linux' && process.arch === 'x64') {
binary = path.join(__dirname, 'linux-x64', 'relay');
} else if (process.platform === 'win32' && process.arch === 'x64') {
Expand Down
5 changes: 4 additions & 1 deletion packages/relay-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"bugs": "https://github.com/facebook/relay/issues",
"repository": "facebook/relay",
"main": "index.js",
"bin": "cli.js"
"bin": "cli.js",
"dependencies": {
"detect-libc": "^1.0.3"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2586,6 +2586,11 @@ detect-file@^1.0.0:
resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7"
integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=

detect-libc@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=

detect-newline@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
Expand Down