Skip to content

Commit

Permalink
Merge remote-tracking branch 'turbo/main' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Oct 24, 2022
2 parents f9fac48 + 7bdc634 commit 2af2d41
Show file tree
Hide file tree
Showing 100 changed files with 20,278 additions and 438 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.rs]
indent_size = 4

[*.t]
trim_trailing_whitespace = false

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
using: "composite"
steps:
- name: Setup pnpm
uses: pnpm/[email protected].2
uses: pnpm/[email protected].3
with:
version: 7.12.1

Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/build_go_lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build Go Library

env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

on:
workflow_dispatch:
inputs:
release_branch:
description: "Staging branch to run release from"

jobs:
smoke-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Test
run: pnpm -- turbo run test --filter=cli --color

darwin:
needs: [smoke-test]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Build Artifacts
run: cd cli && make build-lib-turbo-darwin
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: turbo-lib-darwin-${{ inputs.release_branch }}
path: cli/dist-darwin

# compiles linux and windows in a container
cross:
needs: [smoke-test]
runs-on: ubuntu-latest
container:
image: docker://ghcr.io/vercel/turbo-cross:v1.18.5
steps:
- uses: actions/checkout@v3
with:
ref: "${{ inputs.release_branch }}"
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Build Artifacts
run: cd cli && make build-lib-turbo-cross
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: turbo-lib-cross-${{ inputs.release_branch }}
path: cli/dist-cross
192 changes: 192 additions & 0 deletions .github/workflows/build_rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: Build Rust Wrapper

on:
workflow_dispatch:
inputs:
release_branch:
description: "Staging branch to run release from"

jobs:
build-native:
name: "Build Native"
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: "x86_64-apple-darwin"
lib-cache-key: turbo-lib-darwin-${{ inputs.release_branch }}
- host: macos-latest
target: "aarch64-apple-darwin"
lib-cache-key: turbo-lib-darwin-${{ inputs.release_branch }}
- host: ubuntu-latest
target: "x86_64-unknown-linux-gnu"
lib-cache-key: turbo-lib-cross-${{ inputs.release_branch }}
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
- host: ubuntu-latest
target: "aarch64-unknown-linux-gnu"
lib-cache-key: turbo-lib-cross-${{ inputs.release_branch }}
rustflags: 'RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc"'
setup: "sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu"
- host: windows-latest
target: x86_64-pc-windows-gnu
lib-cache-key: turbo-lib-cross-${{ inputs.release_branch }}
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
with:
ref: "${{ inputs.release_branch }}"

- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
profile: minimal
override: true
# TODO: copied from turbo tooling, may need to make this file-driven
toolchain: nightly-2022-09-23
target: ${{ matrix.settings.target }}

# - name: Cache cargo registry
# uses: actions/cache@v3
# with:
# path: ~/.cargo/registry
# key: ${{ matrix.settings.target }}-cargo-registry

# - name: Cache cargo index
# uses: actions/cache@v3
# with:
# path: ~/.cargo/git
# key: ${{ matrix.settings.target }}-cargo-index

- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
# Optional, workflow file name or ID
# If not specified, will be inferred from run_id (if run_id is specified), or will be the current workflow
workflow: build_go_lib.yml
# Optional, the status or conclusion of a completed workflow to search for
# Can be one of a workflow conclusion:
# "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required"
# Or a workflow status:
# "completed", "in_progress", "queued"
# Use the empty string ("") to ignore status or conclusion in the search
workflow_conclusion: success
# Optional, will use the specified branch. Defaults to all branches
branch: ${{ inputs.release_branch }}
# Optional, uploaded artifact name,
# will download all artifacts if not specified
# and extract them into respective subdirectories
# https://github.com/actions/download-artifact#download-all-artifacts
name: ${{ matrix.settings.lib-cache-key }}
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: shim/libturbo
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail

# TODO: re-enable this instead of the above when this runs together with the go library build
# - name: Download Cross-compiled Artifacts
# uses: actions/download-artifact@v3
# with:
# name: ${{ matrix.settings.lib-cache-key }}
# path: shim/libturbo
- name: Build Setup
if: ${{ matrix.settings.setup }}
run: ${{ matrix.settings.setup }}

- name: Build
if: ${{ !matrix.settings.docker }}
run: cd shim && ${{ matrix.settings.rustflags }} cargo build --release --target ${{ matrix.settings.target }}

- name: Build in Docker
if: ${{ matrix.settings.docker }}
run: cd shim && ${{ matrix.settings.rustflags }} cargo build --release --target ${{ matrix.settings.target }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: shim-${{ matrix.settings.target }}
path: shim/target/${{ matrix.settings.target }}/release/turbo*

final-publish:
name: "Publish To NPM"
runs-on: ubuntu-latest
needs: [build-native]
steps:
- uses: actions/checkout@v3
with:
ref: "${{ inputs.release_branch }}"
- run: git fetch origin --tags
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- uses: ./.github/actions/setup-go
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Configure git
run: |
git config --global user.name 'Turbobot'
git config --global user.email '[email protected]'
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
install-only: true
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

- name: Download Apple ARM64 Artifacts
uses: actions/download-artifact@v3
with:
name: shim-aarch64-apple-darwin
path: cli/dist-darwin-arm64

- name: Download Ubuntu ARM64 Artifacts
uses: actions/download-artifact@v3
with:
name: shim-aarch64-unknown-linux-gnu
path: cli/dist-linux-arm64

- name: Download Windows ARM64 (Ships as x86_64) Artifacts
uses: actions/download-artifact@v3
with:
name: shim-x86_64-pc-windows-gnu
path: cli/dist-windows-arm64

- name: Download Ubuntu x86_64 Artifacts
uses: actions/download-artifact@v3
with:
name: shim-x86_64-unknown-linux-gnu
path: cli/dist-linux-amd64

- name: Download Apple x86_64 Artifacts
uses: actions/download-artifact@v3
with:
name: shim-x86_64-apple-darwin
path: cli/dist-darwin-amd64

- name: Download Windows x86_64 Artifacts
uses: actions/download-artifact@v3
with:
name: shim-x86_64-pc-windows-gnu
path: cli/dist-windows-amd64

- name: Perform Release
run: cd cli && make publish-shim
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# TODO: probably don't need to upload this once we've verified the snapshots
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: shim-combined
path: cli/dist
2 changes: 1 addition & 1 deletion .github/workflows/pr-go-run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- uses: pnpm/[email protected].2
- uses: pnpm/[email protected].3
with:
version: 7.2.1

Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,16 @@ package-lock.json
# generated by cargo xtask publish
packages/node-module-trace/npm
artifacts
.turbo
.vercel
.DS_Store
.env
vendor/
data
*.log
todos.md
.store
.npmrc
.idea/
cli/libturbo.a
cli/libturbo.h
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"mode": "debug",
"program": "${workspaceRoot}/cli/cmd/turbo",
"cwd": "${workspaceRoot}/benchmark/large-monorepo",
"args": ["run", "build", "-vvv", "--experimental-use-daemon"]
"args": ["run", "build", "-vvv"]
},
{
"name": "Client",
Expand All @@ -48,7 +48,7 @@
"mode": "debug",
"program": "${workspaceRoot}/cli/cmd/turbo",
"cwd": "${workspaceRoot}/examples/basic",
"args": ["run", "build", "-vvv", "--experimental-use-daemon"]
"args": ["run", "build", "-vvv"]
},
{
"name": "turbo --version",
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"gopls": {
"experimentalWorkspaceModule": true
},
"go.lintTool": "golangci-lint"
"go.lintTool": "golangci-lint",
"files.associations": {
"libturbo.h": "c"
},
}
2 changes: 2 additions & 0 deletions cli/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ run:
timeout: 5m
modules-download-mode: readonly
go: 1.17
skip-dirs:
- internal/yaml # vendored upstream library
skip-files:
- internal/chrometracing/chrometracing.go # vendored upstream library

Expand Down
Loading

0 comments on commit 2af2d41

Please sign in to comment.