Skip to content

Commit 828efb5

Browse files
committed
Merge remote-tracking branch 'upstream/master' into learn-ocaml-editor
* upstream/master: (37 commits) Conflicts: learn-ocaml.opam
2 parents 7db3731 + ff9f091 commit 828efb5

26 files changed

+694
-117
lines changed

.ci-macosx.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ eval $(opam env)
1111

1212
opam install -y -j 2 . --deps-only --locked
1313
make && make opaminstall
14+
15+
# See src/main/linking_flags.sh
16+
make detect-libs
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: 'Bug:'
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
> Related issue(s) or PR(s):
11+
> Related project scope(s) (ex: client, CSS, grading, etc...) :
12+
> Related user(s):
13+
14+
## Bug description
15+
16+
A clear and concise description of what the bug is.
17+
18+
### To Reproduce
19+
20+
Steps to reproduce the behavior:
21+
22+
1. Go to '...'
23+
2. Click on '....'
24+
3. Scroll down to '....'
25+
4. See error
26+
27+
### Expected behavior
28+
29+
A clear and concise description of what you expected to happen.
30+
31+
### Screenshots
32+
33+
If applicable, add screenshots to document your problem.
34+
## Current configuration
35+
36+
- OS: [e.g. iOS]
37+
- Browser [e.g. chrome, safari]
38+
- Version [e.g. 22]
39+
40+
## Additional context
41+
42+
Add any other context about the problem here.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: 'Feat:'
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
> Related issue(s) or PR(s):
11+
> Related project scope(s) (ex: client, CSS, grading, etc...) :
12+
> Related user(s):
13+
14+
## The problem
15+
16+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
17+
18+
### Wanted solution
19+
20+
A clear and concise description of what you want to happen.
21+
22+
### Considered alternatives
23+
24+
A clear and concise description of any alternative solutions or features you've considered.
25+
26+
## Additional context
27+
28+
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Question
3+
about: Ask a question about this project
4+
title: 'Question:'
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
> Related issue(s) or PR(s):
11+
> Related project scope(s) (ex: client, CSS, grading, etc...) :
12+
> Related user(s):
13+
14+
## The question
15+
16+
A clear and concise description of what you want to know.
17+
18+
### What has already been tested
19+
20+
A clear and concise description of what you have already tried.
21+
22+
## Current configuration
23+
24+
- OS: [e.g. iOS]
25+
- Browser [e.g. chrome, safari]
26+
- Version [e.g. 22]
27+
28+
## Additional context
29+
30+
Add any other context or screenshots about the inquiry.

.github/workflows/build-and-test.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,33 @@ jobs:
2222
run: "make docker-images"
2323
- name: Run learn-ocaml build on demo-repository
2424
run: "docker run --rm -v $(pwd)/demo-repository:/repository learn-ocaml -- build"
25-
- name: Clone learn-ocaml-corpus
25+
- name: Clone learn-ocaml-corpus inside tests/corpuses
2626
run: "mkdir tests/corpuses && cd tests/corpuses && git clone --depth=1 https://github.com/ocaml-sf/learn-ocaml-corpus.git && cd ../.."
27-
- name: Run learn-ocaml build on learn-ocaml-corpus
27+
- name: Run tests
28+
run: "cd tests && bash -c ./runtests.sh"
29+
30+
client_using_other_server:
31+
name: Build learn-ocaml-client and run quick tests
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
server_image:
37+
- 'ocamlsf/learn-ocaml:0.12'
38+
- 'learn-ocaml' # use learn-ocaml image built from master
39+
env:
40+
USE_CLIENT_IMAGE: 'true'
41+
steps:
42+
- name: Check out the repo
43+
uses: actions/checkout@v2
44+
- name: Build Docker images
45+
run: "make docker-images"
46+
- name: Pull server_image
47+
if: ${{ matrix.server_image != 'learn-ocaml' }}
48+
run: "docker pull ${{ matrix.server_image }} && docker tag ${{ matrix.server_image }} learn-ocaml"
49+
- name: Print images metadata
50+
run: "docker inspect -f '{{json .Config.Labels}}' learn-ocaml-client learn-ocaml | jq"
51+
- name: Run tests
2852
run: "cd tests && bash -c ./runtests.sh"
2953

3054
build_extra_tests:
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Generate static binaries
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches:
10+
- '**'
11+
jobs:
12+
static-bin-linux:
13+
name: Builds static Linux binaries
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v2
18+
- name: Build the binaries
19+
run: |
20+
./scripts/static-build.sh
21+
- name: Test the binaries
22+
run: |
23+
bin=(./learn-ocaml-client ./learn-ocaml-server ./learn-ocaml)
24+
file "${bin[@]}"
25+
ldd "${bin[@]}"
26+
for b in "${bin[@]}"; do ( set -x; "$b" --version ); done
27+
- name: Archive static binaries
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: static-binaries-linux
31+
path: |
32+
learn-ocaml
33+
learn-ocaml-server
34+
learn-ocaml-client
35+
static-bin-macos:
36+
name: Builds static Macos binaries
37+
runs-on: macos-latest
38+
env:
39+
OPAMYES: 1
40+
OPAMDEPEXTYES: 1
41+
steps:
42+
- name: Check out the repo
43+
uses: actions/checkout@v2
44+
- name: Show OS version
45+
run: |
46+
sw_vers
47+
system_profiler SPSoftwareDataType
48+
uname -a
49+
# Need unreleased 2.1.0~rc
50+
# - name: Retrieve opam
51+
# run: |
52+
# mkdir "$HOME/bin"
53+
# wget https://github.com/ocaml/opam/releases/download/2.1.0-beta2/opam-2.1.0-beta2-x86_64-macos -O $HOME/bin/opam
54+
# chmod a+x $HOME/bin/opam
55+
# echo "$HOME/bin" >> $GITHUB_PATH
56+
- name: Install latest opam
57+
run: |
58+
brew install opam --HEAD
59+
- name: Prepare build environment
60+
run: |
61+
opam init -a --bare
62+
opam switch create . ocaml-base-compiler 'dune<2' --deps-only
63+
- name: Build the binaries
64+
run: |
65+
opam exec -- make LINKING_MODE=static
66+
- name: Test the binaries
67+
run: |
68+
bin=(./learn-ocaml-client ./learn-ocaml-server ./learn-ocaml)
69+
dir="_build/install/default/bin"
70+
file "$dir"/*
71+
otool -L "$dir"/*
72+
for b in "${bin[@]}"; do ( set -x; "$dir/$b" --version ); done
73+
- name: Archive static binaries
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: static-binaries-macos
77+
path: _build/install/default/bin/*

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ translations/*.pot
3535
**/.merlin
3636

3737
tests/corpuses/*
38+
39+
detect-libs.*

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,25 @@ travis: # From https://stackoverflow.com/questions/21053657/how-to-run-travis-ci
9090
INSTANCE="travisci/ci-garnet:packer-1512502276-986baf0"; \
9191
docker run --name $$BUILDID -dit $$INSTANCE /sbin/init && \
9292
docker exec -it $$BUILDID bash -l
93+
94+
.PHONY: static-binaries
95+
static-binaries:
96+
./scripts/static-build.sh
97+
98+
BINARIES = src/main/learnocaml_client.bc src/main/learnocaml_main.bc src/main/learnocaml_server_main.exe
99+
100+
.PHONY: detect-libs
101+
detect-libs:
102+
$(RM) $(addprefix _build/default/,$(BINARIES))
103+
+sort=false; \
104+
baseid="detect-libs.$$$$"; echo ...; \
105+
$(MAKE) LINKING_MODE=dynamic OCAMLPARAM="_,verbose=1" > $$baseid.log 2>&1; \
106+
for bin in $(BINARIES); do \
107+
base=$${bin#src/main/}; base=$${base%.*}; \
108+
grep -e "'$$bin'" $$baseid.log > $$baseid.$$base.log; \
109+
printf "%s: " "$$base"; \
110+
( sed -e "s/'//g; s/ /\\$$(printf '\n/g')" $$baseid.$$base.log | grep -e "^-l" | \
111+
if [ "$$sort" = true ]; then printf "(sorted) "; sort -u; else cat; fi | xargs echo ); \
112+
done; echo; \
113+
cat $$baseid.*.log; \
114+
$(RM) $$baseid.*log

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Howtos
2020
* [How to submit an exercise to the global corpus?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-submit-an-exercise.md)
2121
* [How to deploy an instance of Learn OCaml?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-deploy-a-learn-ocaml-instance.md)
2222
* [How to deploy Learn-OCaml statically?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-deploy-learn-ocaml-statically.md)
23+
* [How to practice OCaml with Learn-OCaml?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-practice-ocaml.md)
2324

2425
Contacts
2526
--------

demo-repository/exercises/demo2/descr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2-
This exercise is just another demo for the exercise environment.
1+
The following example link will open another tab/window: [OCaml](https://ocaml.org "External link")
2+
This exercise is just another demo for the exercise environment.
33
<a href="" onclick="top.location='/exercises/demo/';">Test</a>
44

55
<details>

0 commit comments

Comments
 (0)