Skip to content

Deploy 0.254.0 to xplat #8163

Deploy 0.254.0 to xplat

Deploy 0.254.0 to xplat #8163

Workflow file for this run

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
name: CI
on: [push, pull_request]
jobs:
vscode-extension-lint:
name: VSCode Extension Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./vscode-extension
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 20.x
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: ESLint
run: yarn --ignore-engines run lint
- name: Prettier
run: yarn --ignore-engines run prettier-check
- name: Typecheck
run: yarn --ignore-engines run typecheck
js-tests:
name: JS Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn run jest
js-lint:
name: JS Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 20.x
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Test dependencies
run: yarn run test-dependencies
- name: Lint
run: yarn run lint
- name: Prettier
run: yarn run prettier-check
typecheck:
name: Flow Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 20.x
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Flow
run: yarn run typecheck
build-tests:
name: Rust Tests (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: ubuntu-latest
os: ubuntu-latest
features: vendored
- target: macos-latest
os: macos-latest
- target: windows-latest
os: windows-latest
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
override: true
- name: "Run tests"
run: cargo test --manifest-path=compiler/Cargo.toml --locked ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
build-test-projects:
name: Compiler output check (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: ubuntu-latest
os: ubuntu-latest
features: vendored
- target: macos-latest
os: macos-latest
# TODO: Fix windows build. It is failing on Resolvers
# - target: windows-latest
# os: windows-latest
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
override: true
- name: "Update fixture tests"
run: ./scripts/update-fixtures.sh
- name: "Build test project"
run: cargo run --manifest-path=compiler/Cargo.toml --bin relay --release ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }} ./compiler/test-project/relay.config.json
- name: "Build Relay unit-test artifacts"
run: cargo run --manifest-path=compiler/Cargo.toml --bin relay --release ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }} ./scripts/config.tests.json
- name: "Check working directory status"
run: './scripts/check-git-status.sh'
rust-lint:
name: Rust Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
# Should stay in sync with tools/third-party/rustfmt/.rustfmt-version
toolchain: nightly-2024-07-28
override: true
components: rustfmt
- name: "rustfmt"
run: grep -r --include "*.rs" --files-without-match $'\x40generated' crates | xargs rustfmt --check --config="skip_children=true"
working-directory: ./compiler/
build-compiler:
name: Build Rust Compiler (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-bin-linux-x64
packages: musl-tools
features: vendored
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-bin-linux-arm64
features: vendored
cross: true
- target: x86_64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-bin-macos-x64
- target: aarch64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-bin-macos-arm64
- target: x86_64-pc-windows-msvc
os: windows-latest
build-name: relay.exe
artifact-name: relay-bin-win-x64
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
override: true
target: ${{ matrix.target.target }}
- uses: actions/setup-node@v2
if: github.event_name == 'push' && github.repository == 'facebook/relay' && github.ref == 'refs/heads/main'
with:
node-version: 20.x
cache: 'yarn'
- name: Install dependencies
if: github.event_name == 'push' && github.repository == 'facebook/relay' && github.ref == 'refs/heads/main'
run: yarn install --frozen-lockfile --ignore-scripts
- name: Set the compiler version when releasing the `main` branch
if: github.event_name == 'push' && github.repository == 'facebook/relay' && github.ref == 'refs/heads/main'
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
- name: Install cross
if: matrix.target.cross
uses: actions-rs/cargo@v1
with:
command: install
args: cross
# Current published version of cross only works correctly if run from compiler directory
# See related issue https://github.com/cross-rs/cross/issues/615
# actions-rs/cargo@v1 does not support this option https://github.com/actions-rs/cargo/pull/59
# Either we need to install cross from git or manually run cargo / cross instead of using action
- name: Build project
working-directory: compiler
run: ${{ matrix.target.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target.target }} ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.artifact-name }}
path: compiler/target/${{ matrix.target.target }}/release/${{ matrix.target.build-name }}
main-release:
name: Publish to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'facebook/relay'
needs: [js-tests, js-lint, typecheck, build-tests, build-compiler]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Download artifact relay-bin-linux-x64
uses: actions/download-artifact@v4
with:
name: relay-bin-linux-x64
path: artifacts/linux-x64
- name: Download artifact relay-bin-linux-arm64
uses: actions/download-artifact@v4
with:
name: relay-bin-linux-arm64
path: artifacts/linux-arm64
- name: Download artifact relay-bin-macos-x64
uses: actions/download-artifact@v4
with:
name: relay-bin-macos-x64
path: artifacts/macos-x64
- name: Download artifact relay-bin-macos-arm64
uses: actions/download-artifact@v4
with:
name: relay-bin-macos-arm64
path: artifacts/macos-arm64
- name: Download artifact relay-bin-win-x64
uses: actions/download-artifact@v4
with:
name: relay-bin-win-x64
path: artifacts/win-x64
- name: Mark binaries as executable
working-directory: artifacts
run: |
chmod +x linux-x64/relay
chmod +x linux-arm64/relay
chmod +x macos-x64/relay
chmod +x macos-arm64/relay
- name: Build latest (main) version
if: github.ref == 'refs/heads/main'
run: yarn gulp mainrelease
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
- name: Build release version
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: yarn gulp release
- name: Publish to npm
if: github.ref == 'refs/heads/main' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: |
for pkg in dist/*; do
npm publish "./$pkg" ${TAG}
done
env:
TAG: ${{ github.ref == 'refs/heads/main' && '--tag=main' || ((contains(github.ref_name, '-rc.') && '--tag=dev') || '' )}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}