Skip to content

Commit

Permalink
Add GitHub Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Yves Chevallier committed Aug 2, 2020
1 parent 0869136 commit edaf819
Show file tree
Hide file tree
Showing 19 changed files with 269 additions and 129 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig is awesome: https://EditorConfig.org
root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 2

[*.py]
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab
107 changes: 107 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
on:
push:
branches:
- master
create:
tags:

jobs:
build:
name: Build Project
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
with:
submodules: true
- name: Build Docker Image
run: make pull
- name: Build
run: make
- name: Upload handout
uses: actions/upload-artifact@v2
with:
name: pdf
path: |
_build/latex/main.pdf
if-no-files-found: error
- name: Upload man-page
uses: actions/upload-artifact@v2
with:
name: man
path: |
_build/man/info.1
if-no-files-found: error
- name: Upload html
uses: actions/upload-artifact@v2
with:
name: html
path: |
_build/html
if-no-files-found: error
deploy:
name: Deploy on GH-Pages
needs: build
runs-on: ubuntu-latest
if: contains(github.ref, 'master')
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: html
name: html
- run: ls -al html
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: html
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: man
path: dist/
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: pdf
path: dist/
- name: Upload Handout
id: upload-pdf-handout
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/main.pdf
asset_name: handout.pdf
asset_content_type: application/pdf
- name: Upload Manpage
id: upload-manpage
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/info.1
asset_name: info.1
asset_content_type: text/plain
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

DOCKER = docker run -v "$$(pwd -P):/srv" -w/srv nowox/latex:2.0
DOCKER_IMAGE = "nowox/latex:2.0"
DOCKER = docker run -v "$$(pwd -P):/srv" -w/srv $(DOCKER_IMAGE)

all: artifacts html man pdf
all: html man pdf

html: Makefile
html: Makefile | artifacts
$(DOCKER) $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

man: Makefile
Expand All @@ -19,7 +20,7 @@ man: Makefile
pdf: Makefile
$(DOCKER) $(SPHINXBUILD) -M latexpdf "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

latex: Makefile
latex: Makefile | artifacts
$(DOCKER) $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

$(ARTIFACTS_DIR):
Expand All @@ -30,7 +31,10 @@ $(ARTIFACTS_DIR)/heig-vd.pdf:

artifacts: $(ARTIFACTS_DIR)/heig-vd.pdf

pull:
docker pull $(DOCKER_IMAGE)

clean:
$(RM) -rf _build _static

.PHONY: all clean artifacts dist
.PHONY: all clean artifacts dist pull
117 changes: 60 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,60 @@
# Polycopié d'informatique

[![Build Status](https://travis-ci.org/heig-tin-info/info-handout.svg?branch=master)](https://travis-ci.org/heig-tin-info/info-handout)

Ce référentiel contient le polycopié d'informatique 1 et 2 disponible en formats:

- PDF (voir [releases](https://github.com/heig-tin-info/info-handout/releases))
- HTML (https://heig-tin-info.github.io/handout/)
- Manpage (voir [releases](https://github.com/heig-tin-info/info-handout/releases))

## Install

```bash
git clone https://github.com/heig-vd-tin/info-handout.git
cd info-handout
git submodule init
git submodulee update
make html
make pdf
```

Alternativement vous pouvez utiliser Docker et suivre le contenu de `.travis.yml`.

## Intégration continue

Les nouvelles releases sont automatiquement générées par Travis CI:

- A chaque nouveau tag, les version PDF et MAN sont générées
- A chaque commit sur la branche `master` une version HTML est générée

## Build

Make sure you have `sphinx` and the HTML theme installed `sphinx-heigvd-theme`.

```bash
sudo apt-get install -y librsvg2-bin
sudo apt-get install -y python3 python3-pip python3-sphinx

sudo pip3 install sphinx-heigvd-theme
sudo pip3 install sphinxcontrib-svg2pdfconverter
```

Then if you would like to generate the PDF version you need LaTeX as well.

```bash
sudo apt-get install librsvg2-bin # For conversion from svg to pdf

sudo apt-get install texlive-latex-base
sudo apt-get install texlive-fonts-recommended
sudo apt-get install texlive-fonts-extra
sudo apt-get install texlive-latex-extra

sudo apt-get install latexmk

sudo pip install sphinx
sudo pip install sphinxcontrib-svg2pdfconverter
```
# Polycopié d'informatique

![.github/workflows/ci.yml](https://github.com/heig-tin-info/handout/workflows/.github/workflows/ci.yml/badge.svg?branch=master)

![version](https://img.shields.io/github/v/release/heig-tin-info/handout)
![downloads](https://img.shields.io/github/downloads/heig-tin-info/handout/latest/total)

Ce référentiel contient le polycopié d'informatique 1 et 2 disponible en formats:

- PDF (voir [releases](https://github.com/heig-tin-info/info-handout/releases))
- HTML (https://heig-tin-info.github.io/handout/)
- Manpage (voir [releases](https://github.com/heig-tin-info/info-handout/releases))

## Install

```bash
git clone https://github.com/heig-vd-tin/info-handout.git
cd info-handout
git submodule init
git submodulee update
make html
make pdf
```

Alternativement vous pouvez utiliser Docker et suivre le contenu de `.travis.yml`.

## Intégration continue

Les nouvelles releases sont automatiquement générées par Travis CI:

- A chaque nouveau tag, les version PDF et MAN sont générées
- A chaque commit sur la branche `master` une version HTML est générée

## Build

Make sure you have `sphinx` and the HTML theme installed `sphinx-heigvd-theme`.

```bash
sudo apt-get install -y librsvg2-bin
sudo apt-get install -y python3 python3-pip python3-sphinx

sudo pip3 install sphinx-heigvd-theme
sudo pip3 install sphinxcontrib-svg2pdfconverter
```

Then if you would like to generate the PDF version you need LaTeX as well.

```bash
sudo apt-get install librsvg2-bin # For conversion from svg to pdf

sudo apt-get install texlive-latex-base
sudo apt-get install texlive-fonts-recommended
sudo apt-get install texlive-fonts-extra
sudo apt-get install texlive-latex-extra

sudo apt-get install latexmk

sudo pip install sphinx
sudo pip install sphinxcontrib-svg2pdfconverter
```
33 changes: 25 additions & 8 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,35 @@
- [ ] Index at the end of document?
- [ ] Exercice thing...
- [ ] LaTeX pygments style
- [ ] Reduce PDF size (should be much smaller!)
- [ ] Glossaire

.. only:: comment
## Index

.. _fig_allocation:
.. figure:: ../assets/figures/dist/memory/malloc.*
Lien dans les index:

# Propositions
```
Compilation, 145
- séparée, 122, 291
- erreurs, 111
```

## Exercices

- Chaque chapitre à des exercices:

```
Exercice 3.8
...
> Voir solution...(html only)
```

- Examen
- Mettre à disposition de l'étudiant un laptop pas cher avec un éditeur de texte basic (pas de réseau)
- Facilite le rendu d'examen, facilite la correction
- Eviter les scanf....
- La version PDF à une section "Solution des exercices"
- Sous section "Solutions du chapitre 8"
- Puis "Exercice 8.2"

## Sphinx

Expand Down
Binary file modified assets/images/binary-tree.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/eniac.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/eniac.png
Binary file not shown.
Binary file added assets/images/kamaji.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/kamaji.png
Binary file not shown.
Binary file added assets/images/kernighan-ritchie-thompson.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/kernighan-ritchie-thompson.png
Binary file not shown.
Binary file added assets/images/library.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/loom.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 0 additions & 37 deletions backmatter/colophon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,4 @@
Colophon
========

Sources
=======

L'écriture du présent ouvrage a été réalisée en utilisant `reStructuredText <https://en.wikipedia.org/wiki/ReStructuredText>`__, un langage couramment utilisé pour l'écriture de documentation et largement utilisé dans la communauté Python. Ce langage s'intègre dans le projet Docutils qui s'inspire d'outils tels que Javadoc. La compilation des sources est réalisée sous Sphinx, un paquet Python permettant de générer une documentation HTML ainsi qu'un ouvrage PDF via LaTeX.

Conventions
===========

Symbole d'égalité
-----------------

Le signe d'égalité ``=`` peut aisément être confondu avec l'opérateur d'affectation ``=`` utilisé en C. Dans certains exemples ou l'on montre une égalité entre différentes écritures, le signe d'égalité triple (:unicode:`U+2261`) est utilisé pour faire disparaître toute ambiguïté :

.. code-block::
'a' ≡ 0b1100001 ≡ 97 ≡ 0x61 ≡ 00141
Symbole de remplissage
----------------------

Dans les exemples donnés, on voit régulièrement ``while (condition) { 〰 }`` ou ```` (:unicode:`U+3030`) indique une continuité logique d'opération. Le symbole exprime ainsi ``...`` (`points de suspension <https://fr.wikipedia.org/wiki/Points_de_suspension>`__ ou *ellipsis*). Or pour ne pas confondre avec le symbole C ``...`` utilisé dans les fonctions à arguments variables tels que ``printf``.

Types de données
----------------

Les conventions C s'appliquent à la manière d'exprimer les grandeurs suivantes :

- ``0xABCD`` pour les valeurs hexadécimales (``/0x[0-9a-f]+/i``)
- ``00217`` pour les valeurs octales (``/0[0-7]+/``)
- ``'c'`` pour les caractères (``/'([^']|\\[nrftvba'])'/``)
- ``123`` pour les grandeurs entières (``/-?[1-9][0-9]*/``)
- ``12.`` pour les grandeurs réelles en virgule flottante

Encodage de caractère
---------------------

Il est souvent fait mention dans ce cours la notation du type :unicode:`U+01AE`, il s'agit d'une notation unicode qui ne dépend pas d'un quelconque encodage. Parler du caractère ASCII 234 est incorrect car cela dépend de la table d'encodage utilisée; en revanche, la notation unicode est exacte.

Loading

0 comments on commit edaf819

Please sign in to comment.