Skip to content

Commit

Permalink
convert circleci workflows to github actions (#533)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #533

Test Plan: https://github.com/robandpdx-org/buck2/actions/runs/7585649935

Reviewed By: ndmitchell

Differential Revision: D52910227

Pulled By: shayne-fletcher

fbshipit-source-id: f2a8964cc2d92614fb3cf77b7792223e308db13e
  • Loading branch information
robandpdx authored and facebook-github-bot committed Jan 19, 2024
1 parent 2d265ce commit 9bc3963
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/build_bootstrap/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: build_bootstrap
runs:
using: composite
steps:
- name: Build `buck2` with `buck2`
run: "$RUNNER_TEMP/artifacts/buck2 build :buck2 -v 2"
shell: bash
10 changes: 10 additions & 0 deletions .github/actions/build_debug/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: build_debug
description: Build buck2 binary (debug)
runs:
using: composite
steps:
- name: Build buck2 binary (debug)
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 -Z unstable-options --out-dir=$RUNNER_TEMP/artifacts
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/build_example_conan/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: build_example_conan
runs:
using: composite
steps:
- name: Build examples/toolchains/conan_toolchain
run: |-
cd examples/toolchains/conan_toolchain
$RUNNER_TEMP/artifacts/buck2 init
cp -r ../../../prelude prelude
# Generate Conan imports. TODO[AH] Make that unnecessary.
PATH="$RUNNER_TEMP/artifacts:$PATH" $RUNNER_TEMP/artifacts/buck2 run //cpp/conan:update -v 2
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
$RUNNER_TEMP/artifacts/buck2 test //... -v 2
shell: bash
9 changes: 9 additions & 0 deletions .github/actions/build_example_no_prelude/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: build_example_no_prelude
runs:
using: composite
steps:
- name: Build example/no_prelude directory
run: |-
cd examples/no_prelude
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
shell: bash
10 changes: 10 additions & 0 deletions .github/actions/build_release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: build_release
description: Build buck2 binary (release)
runs:
using: composite
steps:
- name: Build buck2 binary (release)
run: |-
mkdir $RUNNER_TEMP/artifacts
cargo build --bin=buck2 --release -Z unstable-options --out-dir=$RUNNER_TEMP/artifacts
shell: bash
13 changes: 13 additions & 0 deletions .github/actions/init_opam/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: init_opam
description: Setup OPAM
runs:
using: composite
steps:
- name: Initialize OPAM
run: |
opam init --compiler=5.1.1 --disable-sandboxing -y
echo 'eval $(opam env)' >> ~/.bashrc
shell: bash
- name: Install OPAM packages
run: opam install menhir ppxlib -y
shell: bash
12 changes: 12 additions & 0 deletions .github/actions/print_versions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: print_versions
runs:
using: composite
steps:
- name: Version Info
run: |-
rustup show
rustc --version
cargo --version
rustup --version
python3 --version
shell: bash
7 changes: 7 additions & 0 deletions .github/actions/run_test_py/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: run_test_py
runs:
using: composite
steps:
- name: Run test.py
run: python3 test.py --ci --git --buck2=$RUNNER_TEMP/artifacts/buck2
shell: bash
24 changes: 24 additions & 0 deletions .github/actions/setup_linux_env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup Linux environment
description: Setup Linux environment
runs:
using: composite
steps:
- uses: SebRollen/[email protected]
id: read_rust_toolchain
with:
file: rust-toolchain
field: toolchain.channel
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.read_rust_toolchain.outputs.value }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: buck2-upload
- run: sudo apt-get update
shell: bash
- run: sudo apt-get install opam libzstd-dev python3-pip ghc
shell: bash
- name: Install conan
run: sudo pip3 install conan==1.*
shell: bash
15 changes: 15 additions & 0 deletions .github/actions/setup_macos_env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: setup_macos_env
description: Setup macOS environment
runs:
using: composite
steps:
- name: Install Rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=none
shell: bash
- name: Brew install
run: brew install cmake python3 coreutils opam llvm protobuf zstd ghc
shell: bash
- name: Install conan
run: sudo pip3 install conan==1.*
shell: bash
- uses: "./.github/actions/print_versions"
9 changes: 9 additions & 0 deletions .github/actions/setup_reindeer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: setup_reindeer
runs:
using: composite
steps:
- name: Install Reindeer
run: |-
cargo install --locked --git https://github.com/facebookincubator/reindeer reindeer
reindeer --third-party-dir shim/third-party/rust buckify
shell: bash
27 changes: 27 additions & 0 deletions .github/actions/setup_windows_env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: setup_windows_env
description: Setup Windows environment for building and testing
runs:
using: composite
steps:
- name: Install Rustup
run: |-
choco install -y rustup.install
write-output "[net]`ngit-fetch-with-cli = true" | out-file -append -encoding utf8 $Env:USERPROFILE/.cargo/config.toml
type $Env:USERPROFILE/.cargo/config.toml
shell: pwsh
- name: Create python3 symlink
run: New-Item -ItemType SymbolicLink -Path C:\ProgramData\chocolatey\bin\python3.exe -Target $(Get-Command python).Source
shell: pwsh
- name: Write Powershell profile
run: |-
$psProfileContent = @'
$vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath
$llvmPath = Join-Path $vsPath "VC\Tools\Llvm\x64\bin"
$env:PATH = "$env:USERPROFILE\.cargo\bin;$llvmPath;" + $env:PATH
$env:TEMP = "$env:USERPROFILE\temp"
$env:TMP = $env:TEMP
'@
Add-Content "$PsHome\profile.ps1" $psProfileContent
New-Item -ItemType Directory -Path "$env:USERPROFILE\temp"
shell: pwsh
- uses: "./.github/actions/print_versions"
47 changes: 47 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and test
on:
push:
pull_request:
jobs:
macos-build-examples:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: 14.2.0
- uses: actions/[email protected]
- uses: ./.github/actions/setup_macos_env
- uses: ./.github/actions/init_opam
- uses: ./.github/actions/build_release
- name: Build example/prelude directory
run: |-
eval $(opam env)
cd examples/with_prelude
$RUNNER_TEMP/artifacts/buck2 init
cp -r ../../prelude prelude
source ./ocaml-setup.sh
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
$RUNNER_TEMP/artifacts/buck2 test //... -v 2
- uses: ./.github/actions/build_example_no_prelude
- uses: ./.github/actions/setup_reindeer
- uses: ./.github/actions/build_bootstrap
linux-build-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: ./.github/actions/setup_linux_env
- uses: ./.github/actions/init_opam
- uses: ./.github/actions/build_release
- name: Build example/prelude directory
run: |-
eval $(opam env)
cd examples/with_prelude
$RUNNER_TEMP/artifacts/buck2 init
cp -r ../../prelude prelude
source ./ocaml-setup.sh
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
$RUNNER_TEMP/artifacts/buck2 test //... -v 2
- uses: ./.github/actions/build_example_conan
- uses: ./.github/actions/build_example_no_prelude
- uses: ./.github/actions/setup_reindeer
- uses: ./.github/actions/build_bootstrap

0 comments on commit 9bc3963

Please sign in to comment.