Skip to content

Commit

Permalink
build and test github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne-fletcher authored and Shayne Fletcher committed Jan 17, 2024
1 parent 1228773 commit 36f4240
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build_example_conan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ runs:
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
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/build_example_no_prelude/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ runs:
run: |-
cd examples/no_prelude
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
shell: bash
shell: bash
15 changes: 6 additions & 9 deletions .github/actions/init_opam/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: init_opam
description: |
Setup OCaml environment for building and testing buck2.
description: Setup OPAM
runs:
using: composite
steps:
- name: Init opam
run: |-
- name: Initialize OPAM
run: |
opam init --compiler=5.1.1 --disable-sandboxing -y
opam install menhir ppxlib -y
echo 'eval $(opam env)' >> ~/.bashrc
shell: bash
- name: OCaml Configuration Info
run: |
eval $(opam env) >> $GITHUB_ENV
ocamlopt.opt -config
- name: Install OPAM packages
run: opam install menhir ppxlib -y
shell: bash
12 changes: 8 additions & 4 deletions .github/actions/setup_linux_env/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Setup Linux environment
description: |
Setup Linux environment for building and testing buck2.
description: Setup Linux environment
runs:
using: composite
steps:
Expand All @@ -12,9 +11,14 @@ runs:
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ steps.read_rust_toolchain.outputs.value }}
targets: ${{ matrix.target.triple }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: buck2-upload
key: ${{ matrix.target.triple }}
- 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
32 changes: 6 additions & 26 deletions .github/actions/setup_macos_env/action.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
name: setup_macos_env
description: |
Setup macOS environment for building and testing.
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
shell: bash
- name: Increase open file descriptor limit
run: |-
# Avoid "too many open files" error.
#echo 'sudo launchctl limit maxfiles 9000000 9999999' >> "$GITHUB_ENV"
#echo 'ulimit -Sn 9000000' >> "$GITHUB_ENV"
echo "TODO Increase open file descriptor limit"
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=none
shell: bash
- name: Brew install
run: |-
# Avoid: "Error: The `brew link` step did not complete
# successfully" (for llvm dependency 'six').
rm -f '/usr/local/lib/python3.9/site-packages/six.py'
brew install cmake python3 coreutils opam llvm protobuf zstd ghc
# TODO: Remove once non intel macos platform is supported on /~https://github.com/stepancheg/rust-protoc-bin-vendored/
echo 'export BUCK2_BUILD_PROTOC=/opt/homebrew/opt/protobuf/bin/protoc' >> "$GITHUB_ENV"
echo 'export BUCK2_BUILD_PROTOC_INCLUDE=/opt/homebrew/opt/protobuf/include' >> "$GITHUB_ENV"
shell: bash
- run: sudo pip3 install conan==1.*
shell: bash
- name: Set CARGO_BUILD_JOBS=6 to limit the number of CPUs used
run: echo 'export CARGO_BUILD_JOBS="6"' >> "$GITHUB_ENV"
run: brew install cmake python3 coreutils opam llvm protobuf zstd ghc
shell: bash
- name: Add LLVM to PATH
run: echo 'export PATH=/usr/local/opt/llvm/bin:"$PATH"' >> "$GITHUB_ENV"
- name: Install conan
run: sudo pip3 install conan==1.*
shell: bash
- uses: "./.github/actions/print_versions"
- uses: "./.github/actions/print_versions"
61 changes: 9 additions & 52 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ on:
push:
pull_request:
jobs:
linux-build-and-test:
runs-on: 4-core-ubuntu
steps:
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_linux_env
- uses: ./.github/actions/build_debug
- uses: ./.github/actions/run_test_py
linux-build-examples:
runs-on: 4-core-ubuntu
macos-build-examples:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: 14.2.0
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_linux_env
- uses: ./.github/actions/setup_macos_env
- uses: ./.github/actions/init_opam
- uses: ./.github/actions/build_release
- name: Build example/prelude directory
Expand All @@ -23,32 +19,17 @@ jobs:
cd examples/with_prelude
$RUNNER_TEMP/artifacts/buck2 init
cp -r ../../prelude prelude
# Additional setup for ocaml
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
macos-build-and-test:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: 14.2.0
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_macos_env
- uses: ./.github/actions/build_debug
- uses: ./.github/actions/run_test_py
macos-build-examples:
runs-on: macos-latest
linux-build-examples:
runs-on: ubuntu-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1.6.0
with:
xcode-version: 14.2.0
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_macos_env
- uses: ./.github/actions/setup_linux_env
- uses: ./.github/actions/init_opam
- uses: ./.github/actions/build_release
- name: Build example/prelude directory
Expand All @@ -57,34 +38,10 @@ jobs:
cd examples/with_prelude
$RUNNER_TEMP/artifacts/buck2 init
cp -r ../../prelude prelude
# Additional setup for ocaml
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
windows-build-and-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_windows_env
- uses: ./.github/actions/build_debug
- uses: ./.github/actions/run_test_py
windows-build-examples:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4.1.0
- uses: ./.github/actions/setup_windows_env
- uses: ./.github/actions/build_release
- name: Build example/prelude directory
run: |-
cd examples/with_prelude
& $Env:RUNNER_TEMP/artifacts/buck2 init
copy-item -Path $env:GITHUB_WORKSPACE\prelude -Destination prelude -Recurse
& $Env:RUNNER_TEMP/artifacts/buck2 build //... -v 2
& $Env:RUNNER_TEMP/artifacts/buck2 test //... -v 2
- uses: ./.github/actions/build_example_no_prelude
- uses: ./.github/actions/setup_reindeer
- uses: ./.github/actions/build_bootstrap
4 changes: 2 additions & 2 deletions examples/no_prelude/toolchains/go_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def _toolchain_config():
)
if os.is_macos:
return struct(
sha256 = "eea1e7e4c2f75c72629050e6a6c7c46c446d64056732a7787fb3ba16ace1982e",
platform = "darwin-arm64",
sha256 = "785170eab380a8985d53896808b0a71336d0ea60e0a26099b4ccec77798b1cf4",
platform = "darwin-amd64",
archive_extension = "tar.gz",
version = version,
)
Expand Down

0 comments on commit 36f4240

Please sign in to comment.