Skip to content

Commit f429321

Browse files
committed
Merge branch 'master' into oauth-moodle
2 parents 2df35d3 + 7c9132d commit f429321

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+413
-187
lines changed

.ci-macosx.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/bin/sh
22

3+
set -e
4+
35
brew update
6+
brew install pkg-config
47
brew install opam
58
brew install libev
69
opam init -y --compiler=4.05.0
710
eval $(opam env)
811

9-
opam install -y . --deps-only --locked
12+
opam install -y -j 2 . --deps-only --locked
1013
make && make opaminstall
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '**'
10+
schedule:
11+
# test master every Saturday at 08:00 UTC
12+
- cron: '0 8 * * 6'
13+
14+
jobs:
15+
build_test_server:
16+
name: Build learn-ocaml and run tests
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check out the repo
20+
uses: actions/checkout@v2
21+
- name: Build Docker images
22+
run: "make docker-images"
23+
- name: Run learn-ocaml build on demo-repository
24+
run: "docker run --rm -v $(pwd)/demo-repository:/repository learn-ocaml -- build"
25+
- name: Clone learn-ocaml-corpus
26+
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
28+
run: "cd tests && bash -c ./runtests.sh"
29+
30+
build_extra_tests:
31+
name: Run dockerized tests
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
dockerfile:
37+
- 'Dockerfile.test-client'
38+
steps:
39+
- name: Check out the repo
40+
uses: actions/checkout@v2
41+
- name: Run docker build
42+
run: 'file=${{ matrix.dockerfile }} && docker build -t "learn-ocaml-${file#*.}" -f "$file" .'
43+
44+
# The Gitter webhook https://webhooks.gitter.im/e/f9e05a2b18ee814cbde2
45+
# was not ported to GitHub Actions syntax.

.github/workflows/build-macos.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: macOS
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
name: Build learn-ocaml on macOS
14+
runs-on: macos-latest
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v2
18+
- name: Build learn-ocaml
19+
run: 'sh .ci-macosx.sh'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Note: you may want to update this file and deploy-tags.yml at once
2+
name: Publish dev (Docker image of master)
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
# deploy master every Saturday at 08:00 UTC
9+
- cron: '0 8 * * 6'
10+
jobs:
11+
push_server:
12+
name: Push learn-ocaml image to Docker Hub
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
- name: Push to Docker Hub
18+
uses: docker/build-push-action@v1
19+
with:
20+
always_pull: true
21+
add_git_labels: true
22+
labels: "org.opencontainers.image.version=master"
23+
username: ${{ secrets.DOCKER_USERNAME }}
24+
password: ${{ secrets.DOCKER_PASSWORD }}
25+
repository: ocamlsf/learn-ocaml
26+
tags: master
27+
push_client:
28+
name: Push learn-ocaml-client image to Docker Hub
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Check out the repo
32+
uses: actions/checkout@v2
33+
- name: Push to Docker Hub
34+
uses: docker/build-push-action@v1
35+
with:
36+
always_pull: true
37+
add_git_labels: true
38+
labels: "org.opencontainers.image.version=master"
39+
username: ${{ secrets.DOCKER_USERNAME }}
40+
password: ${{ secrets.DOCKER_PASSWORD }}
41+
repository: ocamlsf/learn-ocaml-client
42+
target: client
43+
tags: master

.github/workflows/deploy-tags.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Note: you may want to update this file and deploy-master.yml at once
2+
name: Publish latest (Docker image of tags)
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
jobs:
8+
push_server:
9+
name: Push learn-ocaml image to Docker Hub
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v2
14+
- name: Get tag name
15+
run: tag="${{ github.ref }}"; echo "::set-output name=tag::${tag#refs/tags/}"
16+
id: tag
17+
- name: Push to Docker Hub
18+
uses: docker/build-push-action@v1
19+
with:
20+
always_pull: true
21+
add_git_labels: true
22+
labels: "org.opencontainers.image.version=${{ steps.tag.outputs.tag }}"
23+
username: ${{ secrets.DOCKER_USERNAME }}
24+
password: ${{ secrets.DOCKER_PASSWORD }}
25+
repository: ocamlsf/learn-ocaml
26+
tags: latest
27+
tag_with_ref: true
28+
push_client:
29+
name: Push learn-ocaml-client image to Docker Hub
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out the repo
33+
uses: actions/checkout@v2
34+
- name: Get tag name
35+
run: tag="${{ github.ref }}"; echo "::set-output name=tag::${tag#refs/tags/}"
36+
id: tag
37+
- name: Push to Docker Hub
38+
uses: docker/build-push-action@v1
39+
with:
40+
always_pull: true
41+
add_git_labels: true
42+
labels: "org.opencontainers.image.version=${{ steps.tag.outputs.tag }}"
43+
username: ${{ secrets.DOCKER_USERNAME }}
44+
password: ${{ secrets.DOCKER_PASSWORD }}
45+
repository: ocamlsf/learn-ocaml-client
46+
target: client
47+
tags: latest
48+
tag_with_ref: true

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

Dockerfile

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ocaml/opam2:alpine-3.7 as compilation
1+
FROM ocaml/opam:alpine-3.13-ocaml-4.05 as compilation
22
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
33

44
WORKDIR learn-ocaml
@@ -24,28 +24,14 @@ COPY dune dune
2424
RUN sudo chown -R opam:nogroup .
2525

2626
ENV OPAMVERBOSE 1
27+
RUN cat /proc/cpuinfo /proc/meminfo
2728
RUN opam install . --destdir /home/opam/install-prefix --locked
2829

2930

30-
31-
FROM alpine:3.7 as client
32-
33-
ARG BUILD_DATE
34-
ARG VCS_BRANCH
35-
ARG VCS_REF
36-
37-
LABEL org.label-schema.build-date="${BUILD_DATE}" \
38-
org.label-schema.name="learn-ocaml-client" \
39-
org.label-schema.description="learn-ocaml command-line client" \
40-
org.label-schema.url="https://ocaml-sf.org/" \
41-
org.label-schema.vendor="The OCaml Software Foundation" \
42-
org.label-schema.version="${VCS_BRANCH}" \
43-
org.label-schema.vcs-ref="${VCS_REF}" \
44-
org.label-schema.vcs-url="https://github.com/ocaml-sf/learn-ocaml" \
45-
org.label-schema.schema-version="1.0"
31+
FROM alpine:3.13 as client
4632

4733
RUN apk update \
48-
&& apk add ncurses-libs libev dumb-init \
34+
&& apk add ncurses-libs libev dumb-init openssl \
4935
&& addgroup learn-ocaml \
5036
&& adduser learn-ocaml -DG learn-ocaml
5137

@@ -58,26 +44,16 @@ COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bi
5844

5945
ENTRYPOINT ["dumb-init","learn-ocaml-client"]
6046

47+
LABEL org.opencontainers.image.title="learn-ocaml-client"
48+
LABEL org.opencontainers.image.description="learn-ocaml command-line client"
49+
LABEL org.opencontainers.image.url="https://ocaml-sf.org/"
50+
LABEL org.opencontainers.image.vendor="The OCaml Software Foundation"
6151

6252

63-
FROM alpine:3.7 as program
64-
65-
ARG BUILD_DATE
66-
ARG VCS_BRANCH
67-
ARG VCS_REF
68-
69-
LABEL org.label-schema.build-date="${BUILD_DATE}" \
70-
org.label-schema.name="learn-ocaml" \
71-
org.label-schema.description="learn-ocaml app manager" \
72-
org.label-schema.url="https://ocaml-sf.org/" \
73-
org.label-schema.vendor="The OCaml Software Foundation" \
74-
org.label-schema.version="${VCS_BRANCH}" \
75-
org.label-schema.vcs-ref="${VCS_REF}" \
76-
org.label-schema.vcs-url="https://github.com/ocaml-sf/learn-ocaml" \
77-
org.label-schema.schema-version="1.0"
53+
FROM alpine:3.13 as program
7854

7955
RUN apk update \
80-
&& apk add ncurses-libs libev gmp dumb-init msmtp git \
56+
&& apk add ncurses-libs libev dumb-init git openssl \
8157
&& addgroup learn-ocaml \
8258
&& adduser learn-ocaml -DG learn-ocaml
8359

@@ -92,5 +68,10 @@ WORKDIR /home/learn-ocaml
9268

9369
COPY --from=compilation /home/opam/install-prefix /usr
9470

95-
CMD ["build","serve"]
9671
ENTRYPOINT ["dumb-init","learn-ocaml","--sync-dir=/sync","--repo=/repository"]
72+
CMD ["build","serve"]
73+
74+
LABEL org.opencontainers.image.title="learn-ocaml"
75+
LABEL org.opencontainers.image.description="learn-ocaml app manager"
76+
LABEL org.opencontainers.image.url="https://ocaml-sf.org/"
77+
LABEL org.opencontainers.image.vendor="The OCaml Software Foundation"

Dockerfile.test-client

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile is useful for testing purposes
22
# to ensure learn-ocaml-client can be built alone from learn-ocaml-client.opam
33

4-
FROM ocaml/opam2:alpine-3.7 as compilation
4+
FROM ocaml/opam:alpine-3.13-ocaml-4.05 as compilation
55
LABEL Description="learn-ocaml building" Vendor="OCamlPro"
66

77
WORKDIR learn-ocaml
@@ -34,7 +34,7 @@ RUN opam install learn-ocaml-client --destdir /home/opam/install-prefix \
3434
&& ls -l /home/opam/install-prefix/bin/learn-ocaml-client
3535

3636

37-
FROM alpine:3.7 as client
37+
FROM alpine:3.13 as client
3838

3939
ARG BUILD_DATE
4040
ARG VCS_BRANCH
@@ -51,7 +51,7 @@ LABEL org.label-schema.build-date="${BUILD_DATE}" \
5151
org.label-schema.schema-version="1.0"
5252

5353
RUN apk update \
54-
&& apk add ncurses-libs libev dumb-init \
54+
&& apk add ncurses-libs libev dumb-init openssl \
5555
&& addgroup learn-ocaml \
5656
&& adduser learn-ocaml -DG learn-ocaml
5757

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ This is Learn-OCaml, a platform for learning the OCaml language,
55
featuring a Web toplevel, an exercise environment, and a directory of
66
lessons and tutorials.
77

8-
A demo is available at: (http://learn-ocaml.hackojo.org/).
8+
A demo is available [online](https://ocaml-sf.org/learn-ocaml-public/).
99

10-
[![Build Status](https://travis-ci.org/ocaml-sf/learn-ocaml.svg?branch=master)](https://travis-ci.org/ocaml-sf/learn-ocaml)
10+
[![CI](https://github.com/ocaml-sf/learn-ocaml/workflows/CI/badge.svg?branch=master)](https://github.com/ocaml-sf/learn-ocaml/actions?query=workflow%3ACI)
11+
[![macOS](https://github.com/ocaml-sf/learn-ocaml/workflows/macOS/badge.svg?branch=master)](https://github.com/ocaml-sf/learn-ocaml/actions?query=workflow%3AmacOS)
1112
[![learn-ocaml](https://img.shields.io/badge/docker-ocamlsf%2Flearn--ocaml-blue.svg)](https://hub.docker.com/r/ocamlsf/learn-ocaml "Docker image of learn-ocaml")
1213
[![learn-ocaml-client](https://img.shields.io/badge/docker-ocamlsf%2Flearn--ocaml--client-blue.svg)](https://hub.docker.com/r/ocamlsf/learn-ocaml-client "Docker image of learn-ocaml-client")
1314

@@ -18,6 +19,7 @@ Howtos
1819
* [How to write exercises?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-write-exercises.md)
1920
* [How to submit an exercise to the global corpus?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-submit-an-exercise.md)
2021
* [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)
22+
* [How to deploy Learn-OCaml statically?](https://github.com/ocaml-sf/learn-ocaml/blob/master/docs/howto-deploy-learn-ocaml-statically.md)
2123

2224
Contacts
2325
--------
@@ -59,16 +61,16 @@ to redistribute it. See (http://www.exljbris.com/eula.html). You will
5961
optionally have to procure the files by yourself while building the
6062
app. If not, the CSS provides a reasonable fallback font.
6163

62-
Contributions to this repository are placed under the BSD
64+
Contributions to this repository are placed under the MIT
6365
license. This means that we can merge them with the same license as
6466
the rest of the codebase, while you keep all the rights on your code.
6567
And we will not have to bother you with any future license update.
66-
See (https://opensource.org/licenses/BSD-3-Clause).
68+
See (https://opensource.org/licenses/MIT).
6769

6870
Authors and Acknowledgements
6971
----------------------------
7072

71-
Learn-OCaml is a free software by the [OCaml Software Foundation](http://ocaml-sf.org).
73+
Learn-OCaml is a free software by the [OCaml Software Foundation](https://ocaml-sf.org).
7274

7375
* The main authors are Benjamin Canou, Çağdaş Bozman and Grégoire Henry.
7476

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
This exercise is just another demo for the exercise environment.
3+
<a href="" onclick="top.location='/exercises/demo/';">Test</a>
4+
5+
<details>
6+
<summary>Hint</summary>
7+
Use an indirection.
8+
</details>

0 commit comments

Comments
 (0)