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

Automatic deployment #178

Merged
merged 3 commits into from
Jan 12, 2022
Merged
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
40 changes: 18 additions & 22 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OCaml
name: CI

on:
push:
Expand All @@ -11,7 +11,8 @@ on:
- master

jobs:
build:
tests:
name: Unit Tests
runs-on: ubuntu-latest
env:
OCAML_JUPYTER_LOG: debug
Expand All @@ -30,29 +31,13 @@ jobs:
uses: ocaml/setup-ocaml@master
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install Jupyter
run: pip install jupyter
cache-prefix: opam-${{ matrix.ocaml-compiler }}-

- name: Install dependencies
run: |
opam install . -y --deps-only --with-test
opam install 'merlin>3.0.0' -y

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.opam
~/.local
key: ${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}-${{ hashFiles('*.opam') }}
restore-keys: ${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}-

- name: Lint for opam files
run: opam lint *.opam
- name: Lint for source files
Expand All @@ -62,14 +47,25 @@ jobs:
- name: Unit tests
run: opam exec -- dune runtest

# =====
# Integration tests
# =====
##
## Integration tests
##

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'

- name: Install Jupyter
run: pip install jupyter

- name: Install ocaml-jupyter kernel
run: opam pin add jupyter . -y

- name: Install jupyter-archimedes
run: opam pin add jupyter-archimedes . -y

- name: Install kernelspec
run: |
./config/ocaml-jupyter-opam-genspec
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build:
name: Build Artifacts
runs-on: ubuntu-latest
env:
OCAML_VERSION: 4.13.0

steps:
- uses: actions/checkout@v2

- name: Get the version
id: version
run: |
echo "VERSION=$(echo ${{ github.ref }} | sed -e 's#refs/tags/v##g')" >> $GITHUB_ENV

- name: Setup OCaml
uses: ocaml/setup-ocaml@master
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
cache-prefix: opam-${{ env.OCAML_VERSION }}

- name: Install Dependencies
run: opam install dune-release

- name: Archive ocaml-jupyter
run: |
opam exec -- dune-release distrib --skip-build --pkg-version=${{ env.VERSION }} || :
ls ./_build/jupyter-${{ env.VERSION }}.tbz

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: upload
path: ./_build/jupyter-${{ env.VERSION }}.tbz

deploy:
name: Deploy
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Get the version
id: version
run: |
echo "VERSION=$(echo ${{ github.ref }} | sed -e 's#refs/tags/v##g')" >> $GITHUB_ENV

- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: true
prerelease: false
body: |
## Breaking changes
## Minor changes
## Micro changes

- name: Upload Artifacts
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: 'artifacts/upload/*'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OCaml Jupyter

[![Jupyter protocol][protocol-img]][protocol] [![License][license-img]][license] [![Travis Build Status][travis-img]][travis]
[![Jupyter protocol][protocol-img]][protocol] [![License][license-img]][license] [![CI](https://github.com/akabe/ocaml-jupyter/actions/workflows/ci.yaml/badge.svg)](https://github.com/akabe/ocaml-jupyter/actions/workflows/ci.yaml)

[license]: https://github.com/akabe/ocaml-jupyter/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
Expand Down