Skip to content

Commit

Permalink
🚀 RELEASE: Minor config and doc changes
Browse files Browse the repository at this point in the history
Added more instructions and fixed typos in the READMEs. Updated the
pre-commit and actions config to now also test the program on each
release.
  • Loading branch information
GreengagePlum committed Feb 2, 2024
2 parents 1888232 + 657f5b9 commit b5b0597
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 45 deletions.
40 changes: 13 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,11 @@ on: [push, pull_request, workflow_dispatch]
env:
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip"
PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit"
concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true
jobs:
test1:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
.cache/
.venv/
key: ${{ runner.os }}-python
restore-keys: |
${{ runner.os }}-python
- name: Setup Python
run: |
python --version ; pip --version # For debugging
python -m venv .venv/
source .venv/bin/activate
- name: Install Dependencies
run: pip install pre-commit
- run: pre-commit run -a
test2:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -46,13 +28,17 @@ jobs:
- name: Install Dependencies
run: |
sudo apt -y update
sudo apt -y install libncurses-dev libsdl2-dev
sudo apt -y install libncurses-dev libsdl2-dev graphviz doxygen
pip install pre-commit
- run: pre-commit run -a --hook-stage pre-push make
- name: Check format
run: pre-commit run -av
continue-on-error: true
- name: Check compilation
run: pre-commit run -av --hook-stage manual make-ci
- name: Check doc gen
run: pre-commit run -av --hook-stage manual make-doc-ci
- uses: actions/upload-artifact@v3
with:
name: "test-artifact"
path: |
.
!.cache/
!.venv/
pre-commit-test/
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ doc/public/
##### Générateur d'archive
ERKEN_Efe.tar.gz

##### Tests pre-commit
venv/
.venv/
pre-commit-test/

##### Divers
.ds_store
.DS_store
Expand Down
23 changes: 22 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ repos:
name: make (compile-test)
stages: [pre-push]
language: system
entry: make
entry: sh -c 'OUT_PATH=pre-commit-test/build/ ; make OPATH=${OUT_PATH} DPATH=${OUT_PATH} EXEC=${OUT_PATH}sokoban ; rm -rf ${OUT_PATH}'
pass_filenames: false
always_run: true
- id: make-ci
name: make (ci-compile-test)
stages: [manual]
language: system
entry: sh -c 'OUT_PATH=pre-commit-test/build/ ; make OPATH=${OUT_PATH} DPATH=${OUT_PATH} EXEC=${OUT_PATH}sokoban'
pass_filenames: false
always_run: true
- id: make-doc
name: make (doc-test)
stages: [pre-push]
language: system
entry: sh -c 'OUT_PATH=pre-commit-test/doc/ ; make DOCPATH=${OUT_PATH} doc ; rm -rf ${OUT_PATH}'
pass_filenames: false
always_run: true
- id: make-doc-ci
name: make (ci-doc-test)
stages: [manual]
language: system
entry: sh -c 'OUT_PATH=pre-commit-test/doc/ ; make DOCPATH=${OUT_PATH} doc'
pass_filenames: false
always_run: true
28 changes: 24 additions & 4 deletions README.fr.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Sokoban

<!-- Pour la compatibilité de Github et de Doxygen en même temps j'ai du utiliser cette ligne de html pour attacher une image -->
<a href="https://github.com/GreengagePlum/Sokoban/commits/main"><img alt="état du pipeline" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml/badge.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/actions/workflows/test.yml"><img alt="état du pipeline test" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/test.yml/badge.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml"><img alt="état du pipeline deploy" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml/badge.svg"/></a>

<a href="https://github.com/GreengagePlum/Sokoban/blob/main/README.md"><img alt="en" src="https://img.shields.io/badge/lang-en-red.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/blob/main/README.fr.md"><img alt="fr" src="https://img.shields.io/badge/lang-fr-yellow.svg"/></a>
Expand All @@ -12,7 +13,7 @@ Vous trouverez ici [les fichiers de base pour](https://git.unistra.fr/techdevpri

Sokoban est un jeu vidéo de réflexion inventé au Japon. Le joueur doit ranger des caisses sur des cases cibles. Il peut se déplacer dans les quatre directions, et pousser (mais pas tirer) une seule caisse à la fois. Une fois toutes les caisses rangées (c'est parfois un vrai casse-tête), le niveau est réussi et le joueur passe au niveau suivant. ([Article Wikipédia](https://fr.wikipedia.org/wiki/Sokoban))

La documentation en ligne pour ce projet est hébergé par Github Pages et se trouve à l'adresse <https://greengageplum.github.io/sokoban/>. C'est construit automatiquement lors de chaque sortie à l'aide de Github Actions. **Attention**, la documentation est en **français** car j'ai réalisé ce projet pendant ma licence en France.
La documentation en ligne pour ce projet est hébergé par Github Pages et se trouve à l'adresse <https://greengageplum.github.io/Sokoban/>. C'est construit automatiquement lors de chaque sortie à l'aide de Github Actions. **Attention**, la documentation est en **français** car j'ai réalisé ce projet pendant ma licence en France.

## Un aperçu

Expand Down Expand Up @@ -85,7 +86,7 @@ Apple clang version 14.0.0 (clang-1400.0.29.202)

### Comment compiler et exécuter ?

D'abord installez les dépendances avec votre gestionnaire de paquets (apt, dnf, apk, brew, etc.) : **gcc** (GNU C toolchain), **make**, **libsdl2**, **libsdl2-dev**, **libncurses**, **libncurses-dev**.
D'abord installez les dépendances avec votre gestionnaire de paquets (apt, dnf, apk, brew, etc.) : `gcc` (GNU C toolchain), `make`, `libsdl2`, `libsdl2-dev` (pour la compilation), `libncurses`, `libncurses-dev` (pour la compilation).

Puis téléchargez le projet sur votre machine avec une des commandes qui suivent :

Expand Down Expand Up @@ -121,7 +122,7 @@ ou

### Génération de la documentation

D'abord installez les dépendances avec votre gestionnaire de paquets (apt, dnf, apk, brew, etc.) : **doxygen**, **graphviz**.
D'abord installez les dépendances avec votre gestionnaire de paquets (apt, dnf, apk, brew, etc.) : `doxygen`, `graphviz`.

Pour générer la documentation pour votre copie du programme, utilisez la commande suivante et jeter un oeil au fichier `doc/public/index.html` dans votre navigateur de web préféré.

Expand Down Expand Up @@ -167,6 +168,25 @@ Cela est une commande qui regroupe toutes celles qui viennent avant. Elle efface
make cleanall
```

### Environnement de développement

Pour avoir un environnement de développement pour ce projet pour développer en local ou bien pour faire des contributions, suivez les instructions auparavant pour récuperer le code source et installer les dépendances.

Ensuite, vous pouvez si vous choisissez, configurer les tests pour pouvoir les effectuer en local et aussi pour avoir un avis sur comment serait le resultat des tests sur le serveur effectué en CI/CD.

Pour ce faire, installez `python` (version 3) et [`pre-commit`](https://pre-commit.com/).

Une fois vous avez `python`,

```sh
python -m venv .venv # Je conseille de creer un environnment virtuel avec votre méthode préférée
source .venv/bin/activate # Activer l'environnement virtuel
pip install --upgrade pip # Mettre à jour pip
pip install pre-commit # Installer pre-commit
pre-commit install -t pre-commit -t pre-push # Configurer les git hooks
pre-commit run -a --hook-stage pre-push # Effectuer tous les tests pour une premère fois
```

## Comment jouer ?

Utilisez les touches 'h', 'j', 'k', 'l' pour vous déplacer (ou aussi les touches fléchées si vous êtes en mode `--sdl2`).
Expand Down
44 changes: 33 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Sokoban

<!-- For the compatibility of Github and Doxygen at the same time I had to use this line of html to attach an image -->
<a href="https://github.com/GreengagePlum/Sokoban/commits/main"><img alt="pipeline status" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml/badge.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/actions/workflows/test.yml"><img alt="test workflow status" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/test.yml/badge.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml"><img alt="deploy workflow status" src="https://github.com/GreengagePlum/Sokoban/actions/workflows/deploy.yml/badge.svg"/></a>

<a href="https://github.com/GreengagePlum/Sokoban/blob/main/README.md"><img alt="en" src="https://img.shields.io/badge/lang-en-red.svg"/></a>
<a href="https://github.com/GreengagePlum/Sokoban/blob/main/README.fr.md"><img alt="fr" src="https://img.shields.io/badge/lang-fr-yellow.svg"/></a>
Expand All @@ -10,9 +11,9 @@ Here is a programming project in C that I've carried out during the second year

You'll find here [the base files for](https://git.unistra.fr/techdevprintemps2022/SokobanTechDev) the project concerning the game of Sokoban. The instructions are to be found at this address [TP Sokoban](https://techdevprintemps2022.pages.unistra.fr/TP_TechDevEnonce/)

Sokoban is a puzzle video game invented in Japan. The player has to move the crates to the target spots. The player can move in the four directions and push (but not pull) a single box at a time. Once all the crates are put away (it's sometimes a real headache), the level is complete and the player moves on to the next level. ([Wikipedia article](https://en.wikipedia.org/wiki/Sokoban))
Sokoban is a puzzle video game invented in Japan. The player has to move the crates to the target spots. The player can move in the four directions and push (but not pull) a single crate at a time. Once all the crates are put away (it's sometimes a real headache), the level is complete and the player moves on to the next level. ([Wikipedia article](https://en.wikipedia.org/wiki/Sokoban))

The online documentation for this project is hosted by Github Pages and is found at this address <https://greengageplum.github.io/sokoban/>. It is automatically built during each release using Github Actions. **Attention**, the documentation is in **French** since I carried out this project during my bachelor's in France.
The online documentation for this project is hosted by Github Pages and is found at this address <https://greengageplum.github.io/Sokoban/>. It is automatically built during each release using Github Actions. **Attention**, the documentation is in **French** since I carried out this project during my bachelor's in France.

## A preview

Expand All @@ -24,7 +25,7 @@ The online documentation for this project is hosted by Github Pages and is found

<img alt="(Game running with its GUI)" src="images/sokobanGUIv1.0.0.gif"/>

I was inspired by these git repos :
I was inspired by these git repos:

* [TD1 - Criblage](https://gitlab.com/qgoestch/td1-criblage)
* [doxygen-exemple-bidon](https://git.unistra.fr/max.schmitt/doxygen-exemple-bidon)
Expand All @@ -35,9 +36,9 @@ I was inspired by these git repos :

**Efe ERKEN**

Year : 2nd year 3rd semester Autumn 2022
Year: 2nd year 3rd semester Autumn 2022

Groups : TD2-TP4
Groups: TD2-TP4

## gcc/clang versions

Expand All @@ -61,15 +62,15 @@ Apple clang version 14.0.0 (clang-1400.0.29.202)

### How to compile and execute?

First, install the dependencies with your package manager (apt, dnf, apk, brew, etc.): **gcc** (GNU C toolchain), **make**, **libsdl2**, **libsdl2-dev**, **libncurses**, **libncurses-dev**.
First, install the dependencies with your package manager (apt, dnf, apk, brew, etc.): `gcc` (GNU C toolchain), `make`, `libsdl2`, `libsdl2-dev` (for the compilation), `libncurses`, `libncurses-dev` (for the compilation).

Then download the project on your machine with one of the following commands:

```sh
git clone https://github.com/GreengagePlum/Sokoban.git
```

ou
or

```sh
git clone [email protected]:GreengagePlum/Sokoban.git
Expand All @@ -89,23 +90,23 @@ From now on you can execute the game so long as you're in its directory.
./sokoban --console
```

ou
or

```sh
./sokoban --sdl2
```

### Generate the documentation

First, install the dependencies with your package manager (apt, dnf, apk, brew, etc.): **doxygen**, **graphviz**.
First, install the dependencies with your package manager (apt, dnf, apk, brew, etc.): `doxygen`, `graphviz`.

To generate the documentation for your copy of the program, use the following command and take a look at the file `doc/public/index.html` in your favorite web browser.

```sh
make doc
```

Or else, you could see the [online documentation](https://greengageplum.github.io/sokoban/) for the latest version.
Or else, you could see the [online documentation](https://greengageplum.github.io/Sokoban/) for the latest version.

### Generate a redistributable archive

Expand Down Expand Up @@ -143,6 +144,27 @@ This is a command that groups together all that came before. It removes all the
make cleanall
```

### Development environment

To have a developer environment for this projet to develop locally or to make contributions, follow the past instructions to get the source code and install the dependencies.

Ensuite, vous pouvez si vous choisissez, configurer les tests pour pouvoir les effectuer en local et aussi pour avoir un avis sur comment serait le resultat des tests sur le serveur effectué en CI/CD.

Next, you can if you wish, configure the tests to be able to run them locally and also, to have an idea on how the results of the tests on the server done by CI/CD would be.

To do this, install `python` (version 3) and [`pre-commit`](https://pre-commit.com/).

Once you have `python`,

```sh
python -m venv .venv # I advise you to create a virtual environment with your favorite method
source .venv/bin/activate # Activate the virtual environment
pip install --upgrade pip # Upgrade pip
pip install pre-commit # Install pre-commit
pre-commit install -t pre-commit -t pre-push # Configure the git hooks
pre-commit run -a --hook-stage pre-push # Run all the tests for the first time
```

## How to play?

Use the 'h', 'j', 'k', 'l' keys to move (or you can also use the arrow keys if you're in `--sdl2` mode).
Expand Down
5 changes: 5 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

## Features

- [ ] Add more levels
- [ ] Add level progression
- [ ] Add level selection
- [ ] Add level importing
- [ ] Printf display method implementation to add
- [ ] Resizable SDL2 window
- [ ] Ncurses terminal window size warning
Expand Down Expand Up @@ -44,6 +48,7 @@

## Done

- [x] Add pre-commit instructions to READMEs
- [x] GitLab Releases
- [x] CI/CD pages
- [x] Doxygen depends on source and header files
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PROJECT_LOGO = images/LogoSmall.jpg
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = doc/public/
OUTPUT_DIRECTORY = $(DOXY_OUT)

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ cleanall :
doc : $(DOCPATH)

$(DOCPATH) : $(ALL_SOURCES) $(ALL_HEADERS) README.fr.md $(DOXYFILE)
$(DOCGEN) $(DOXYFILE)
DOXY_OUT=$@ $(DOCGEN) $(DOXYFILE)


archive : $(ARCHIVE_NAME)

Expand Down

0 comments on commit b5b0597

Please sign in to comment.