Skip to content

Commit

Permalink
Merge branch 'main' into yarn-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
NickGerleman authored Sep 5, 2023
2 parents 9f17031 + 7d8b917 commit 2cf0796
Show file tree
Hide file tree
Showing 111 changed files with 7,189 additions and 3,681 deletions.
34 changes: 19 additions & 15 deletions javascript/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
* @format
*/

const path = require('path');

module.exports = {
root: true,
ignorePatterns: ['binaries/**', 'build/**', 'dist/**', 'tests/generated/**'],
ignorePatterns: [
'/website',
'**/binaries/**',
'**/build/**',
'**/generated/**',
],
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
plugins: ['prettier'],
rules: {
'no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'no-var': 'error',
'prefer-arrow-callback': 'error',
'prefer-const': 'error',
Expand All @@ -26,25 +30,25 @@ module.exports = {
commonjs: true,
es2018: true,
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
overrides: [
{
files: ['**/*.js'],
parser: '@babel/eslint-parser',
parserOptions: {
babelOptions: {
configFile: path.join(__dirname, '.babelrc.js'),
},
},
},
{
files: ['**/*.ts'],
files: ['**/*.ts', '**/*.tsx'],
extends: ['plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: path.join(__dirname, 'tsconfig.json'),
project: true,
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_'},
],
'@typescript-eslint/no-var-requires': 'off',
},
},
Expand All @@ -55,7 +59,7 @@ module.exports = {
},
},
{
files: ['jest.*', 'tests/**'],
files: ['jest.*', '**/tests/**'],
env: {
node: true,
},
Expand Down
19 changes: 19 additions & 0 deletions .github/actions/setup-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: Setup C++ envirionment
inputs:
toolchain:
description: Compiler toolchain to use (Clang, GCC, or MSVC)
required: false
default: 'Clang'

runs:
using: "composite"
Expand All @@ -7,6 +12,20 @@ runs:
if: ${{ runner.os != 'Windows' }}
uses: ./.github/actions/install-ninja

- name: Set Clang as compiler
if: ${{ inputs.toolchain == 'Clang' }}
shell: bash
run: |
echo "CC=/usr/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
- name: Set GCC as compiler
if: ${{ inputs.toolchain == 'GCC' }}
shell: bash
run: |
echo "CC=/usr/bin/gcc" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++" >> $GITHUB_ENV
- name: Setup VS Developer Command Prompt
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
18 changes: 10 additions & 8 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,38 @@ env:

jobs:
test:
name: Build and Test [${{ matrix.os }}][${{ matrix.mode }}]
runs-on: ${{ matrix.os }}
name: Build and Test [${{ matrix.toolchain }}][${{ matrix.mode }}]
runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }}
strategy:
matrix:
mode: [Debug, Release]
os: [ubuntu-latest] # TODO: fix issues building GTest Binary with MSVC in GitHub Actions
toolchain: [Clang, GCC] # TODO: fix issues building GTest Binary with MSVC in GitHub Actions

steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-cpp
with:
toolchain: ${{ matrix.toolchain }}

- name: Unit tests
run: ./unit_tests ${{ matrix.mode }}

benchmark:
name: Benchmark [${{ matrix.os }}]
runs-on: ${{ matrix.os }}
name: Benchmark [${{ matrix.toolchain }}]
runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain: [Clang, GCC, MSVC]

steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-cpp
with:
toolchain: ${{ matrix.toolchain }}

- name: Build benchmark
run: |
Expand All @@ -60,5 +64,3 @@ jobs:

- name: clang-format
uses: ./.github/actions/clang-format
with:
directory: ./yoga
16 changes: 14 additions & 2 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,29 @@ jobs:
working-directory: javascript

lint:
name: Lint
name: ESLint (All Packages)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: yarn install
run: yarn install --frozen-lockfile
working-directory: javascript

- name: yarn lint
run: yarn lint

typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: yarn install
run: yarn install --frozen-lockfile
working-directory: javascript

- name: yarn tsc
run: yarn tsc
working-directory: javascript

pack:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/validate-swiftpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Swift

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
test:
name: Build
runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Build Debug
run: swift build -c debug

- name: Build Release
run: swift build -c release
41 changes: 41 additions & 0 deletions .github/workflows/validate-website-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Website (Next)

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-js

- name: Build Yoga
run: yarn build
working-directory: javascript

- name: Build Website
run: yarn build
working-directory: website-next

typecheck:
name: Typecheck
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: yarn install
run: yarn install --frozen-lockfile
working-directory: javascript

- name: yarn tsc
run: yarn tsc
working-directory: website-next
20 changes: 19 additions & 1 deletion .github/workflows/validate-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
name: Build
name: Build [Gatsby]
runs-on: ubuntu-20.04

steps:
Expand All @@ -21,3 +21,21 @@ jobs:
- name: yarn build
run: yarn build
working-directory: website

build_next:
name: Build [Docusaurus]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup-js

- name: Build Yoga
run: yarn build
working-directory: javascript

- name: Build Website
run: yarn build
working-directory: website-next
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/binaries/**
**/build/**
**/generated/**
File renamed without changes.
32 changes: 32 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
/*
* 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.
*/


import PackageDescription

let package = Package(
name: "yoga",
products: [
.library(name: "yoga", targets: [ "core" ])
],
targets: [
.target(
name: "core",
path: ".",
sources: [
"yoga"
],
publicHeadersPath: ".",
cxxSettings: [
.headerSearchPath(".")
]
)
],
cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++17")
)
11 changes: 9 additions & 2 deletions Yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ Pod::Spec.new do |spec|
'-std=c++17',
'-fPIC'
]
spec.source_files = 'yoga/**/*.{h,cpp}'
spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h'

spec.swift_version = '5.1'
spec.source_files = 'yoga/**/*.{h,cpp}'
spec.header_mappings_dir = 'yoga'

public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h'
spec.public_header_files = public_header_files

all_header_files = 'yoga/**/*.h'
spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files)
end
2 changes: 0 additions & 2 deletions enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
"WebFlexBasis",
# Conformance fix: https://github.com/facebook/yoga/pull/1028
"AbsolutePercentageAgainstPaddingEdge",
# fix JNI local ref overflows
"FixJNILocalRefOverflows",
],
"PrintOptions": [
("Layout", 1 << 0),
Expand Down
Loading

0 comments on commit 2cf0796

Please sign in to comment.