From 36f4240cbb85bdb6802c7a9a68bfbf4849bc9c62 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sat, 13 Jan 2024 16:16:24 -0500 Subject: [PATCH] build and test github workflows --- .../actions/build_example_conan/action.yml | 2 +- .../build_example_no_prelude/action.yml | 2 +- .github/actions/init_opam/action.yml | 15 ++--- .github/actions/setup_linux_env/action.yml | 12 ++-- .github/actions/setup_macos_env/action.yml | 32 ++-------- .github/workflows/build-and-test.yml | 61 +++---------------- .../no_prelude/toolchains/go_toolchain.bzl | 4 +- 7 files changed, 33 insertions(+), 95 deletions(-) diff --git a/.github/actions/build_example_conan/action.yml b/.github/actions/build_example_conan/action.yml index 6702b8ad52522..6213ab4a5176f 100644 --- a/.github/actions/build_example_conan/action.yml +++ b/.github/actions/build_example_conan/action.yml @@ -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 \ No newline at end of file + shell: bash diff --git a/.github/actions/build_example_no_prelude/action.yml b/.github/actions/build_example_no_prelude/action.yml index 754488977dda3..7f3e09a5effa8 100644 --- a/.github/actions/build_example_no_prelude/action.yml +++ b/.github/actions/build_example_no_prelude/action.yml @@ -6,4 +6,4 @@ runs: run: |- cd examples/no_prelude $RUNNER_TEMP/artifacts/buck2 build //... -v 2 - shell: bash \ No newline at end of file + shell: bash diff --git a/.github/actions/init_opam/action.yml b/.github/actions/init_opam/action.yml index ea307f0fc256c..30f3424627073 100644 --- a/.github/actions/init_opam/action.yml +++ b/.github/actions/init_opam/action.yml @@ -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 diff --git a/.github/actions/setup_linux_env/action.yml b/.github/actions/setup_linux_env/action.yml index 6be7265f23970..e490aff68b091 100644 --- a/.github/actions/setup_linux_env/action.yml +++ b/.github/actions/setup_linux_env/action.yml @@ -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: @@ -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 }} \ No newline at end of file + - 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 diff --git a/.github/actions/setup_macos_env/action.yml b/.github/actions/setup_macos_env/action.yml index 47180f10a391a..a0a9007b4b924 100644 --- a/.github/actions/setup_macos_env/action.yml +++ b/.github/actions/setup_macos_env/action.yml @@ -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" \ No newline at end of file + - uses: "./.github/actions/print_versions" diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8fc474774c860..826b6dd4dc109 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 @@ -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 @@ -57,7 +38,6 @@ 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 @@ -65,26 +45,3 @@ jobs: - 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 diff --git a/examples/no_prelude/toolchains/go_toolchain.bzl b/examples/no_prelude/toolchains/go_toolchain.bzl index 5a0ea76ae1ed9..282de126f597f 100644 --- a/examples/no_prelude/toolchains/go_toolchain.bzl +++ b/examples/no_prelude/toolchains/go_toolchain.bzl @@ -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, )