Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fixing github build: install only opam with apt #893

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/pysa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ jobs:
- name: Install Dependencies
run: |
pip install -r requirements.txt
sudo apt-get install ocaml ocaml-dune

- name: Setup OCaml
uses: avsm/setup-ocaml@8cc6339f55862749298d198ef84788b8d6acdacc # v2.2.10
with:
ocaml-compiler: 4.14.0

- name: Setup opam switch
run: |
opam switch create 4.14.0
echo "OPAM_SWITCH_PREFIX=$HOME/.opam/4.14.0" >> $GITHUB_ENV
echo "CAML_LD_LIBRARY_PATH=$HOME/.opam/4.14.0/lib/stublibs:$HOME/.opam/4.14.0/lib/ocaml/stublibs:$HOME/.opam/4.14.0/lib/ocam" >> $GITHUB_ENV
echo "$HOME/.opam/4.14.0/bin" >> $GITHUB_PATH
echo "/home/opam/.opam/4.14.0/bin" >> $GITHUB_PATH
sudo apt-get install opam

- name: Build Pyre (and Pysa)
run: |
echo ""
echo "--------- initializing switch --------"
./scripts/setup.sh --only-initialize-switch
echo "--------- done initializing switch --------"
echo ""

echo "sanity check, these should be equal: /home/runner/.opam/pyre-4.14.0/bin ${HOME}/.opam/pyre-4.14.0/bin"
echo "ls /home/runner/.opam/pyre-4.14.0/bin ..."
ls /home/runner/.opam/pyre-4.14.0/bin || echo "(no such dir)"

echo ""
echo "--------- building ---------"
echo ""

./scripts/setup.sh --local --no-tests
make -C source
echo "PYTHONPATH=$GITHUB_WORKSPACE/..:$PYTHONPATH" >> $GITHUB_ENV
Expand Down
26 changes: 16 additions & 10 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _run_command(
else:
environment_variables = None
LOG.info(command)
LOG.info("... env vars for ^^ are: %r", environment_variables)
try:
output = subprocess.check_output(
command,
Expand Down Expand Up @@ -407,6 +408,10 @@ def setup(
parser.add_argument("--build-type", type=BuildType)
parser.add_argument("--no-tests", action="store_true")
parser.add_argument("--rust-path", type=Path)
# Skip the build. This is mainly useful for debugging remote environment setup in CI,
# because if anything goes wrong that breaks the build, it will abort CI which
# makes investigations difficult.
parser.add_argument("--only-initialize-switch", action="store_true")

parsed = parser.parse_args()

Expand All @@ -423,16 +428,17 @@ def setup(
produce_dune_file(pyre_directory, build_type)
else:
initialize_opam_switch(opam_root, opam_version, release, add_environment_variables, parsed.rust_path)
full_setup(
opam_root,
opam_version,
pyre_directory,
release=release,
run_tests=not parsed.no_tests,
build_type=build_type,
add_environment_variables=add_environment_variables,
rust_path=parsed.rust_path,
)
if not parsed.only_initialize_switch:
full_setup(
opam_root,
opam_version,
pyre_directory,
release=release,
run_tests=not parsed.no_tests,
build_type=build_type,
add_environment_variables=add_environment_variables,
rust_path=parsed.rust_path,
)


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
.PHONY: dev
dev: configure
@../scripts/generate-version-number.sh development
echo "In makefile, env is... "
env
dune build @install -j auto --profile dev

.PHONY: test
Expand Down
Loading