Skip to content

Commit

Permalink
DOCUMENTATION/CICD: Add docs for the CICD and fix some workflow
Browse files Browse the repository at this point in the history
MINOR
  • Loading branch information
Saverio976 committed Sep 27, 2023
1 parent 65b196b commit a865f80
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/compil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ jobs:

outputs:
workflows: ${{ steps.filter.outputs.workflows }}
src: ${{ steps.filter.outputs.workflows }}
combined: ${{ steps.filter.outputs.workflows == 'true' || steps.filter.outputs.src == 'true' }}
src: ${{ steps.filter.outputs.src }}
cmake: ${{ steps.filter.outputs.cmake }}
combined: ${{ steps.filter.outputs.workflows == 'true' || steps.filter.outputs.src == 'true' || steps.filter.outputs.cmake == 'true' }}

steps:
- name: Checkout
Expand All @@ -24,6 +25,8 @@ jobs:
- '.github/workflows/**'
src:
- 'src/**'
cmake:
- 'CMakeLists.txt'
windows-compil:
runs-on: windows-latest
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Documentation
on:
push:
branches: [main, dev]
on: [push]

jobs:
deploy:
Expand All @@ -24,9 +22,11 @@ jobs:
filters: |
docs:
- 'docs/**'
docs2:
- 'book.toml'
- name: Install latest mdbook
if: steps.filter.outputs.docs == 'true' || github.ref == 'refs/heads/dev'
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || github.ref == 'refs/heads/main'
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
Expand All @@ -35,21 +35,21 @@ jobs:
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build Book
if: steps.filter.outputs.docs == 'true' || github.ref == 'refs/heads/dev'
if: steps.filter.outputs.docs == 'true' || steps.filter.outputs.docs2 == 'true' || github.ref == 'refs/heads/main'
run: mdbook build

- name: Setup Pages
if: steps.filter.outputs.docs == 'true'
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v3

- name: Upload artifact
if: steps.filter.outputs.docs == 'true'
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'book'

- name: Deploy to GitHub Pages
if: steps.filter.outputs.docs == 'true'
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v2
56 changes: 53 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
push:
branches: [main]
branches: [main, feature/RB-52]

env:
BRANCH: "main"
Expand All @@ -28,8 +28,12 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export GITHUB_OUTPUT=$GITHUB_OUTPUT
bash ./.github/workflows/release.sh "${{ env.BRANCH }}"
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
export GITHUB_OUTPUT=$GITHUB_OUTPUT
bash ./.github/workflows/release.sh "${{ env.BRANCH }}"
else
echo "release_tag=0.0.0" >> $GITHUB_OUTPUT
fi
release-windows:
runs-on: windows-latest
Expand All @@ -54,12 +58,27 @@ jobs:
run: Get-ChildItem build -Recurse

- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} ./r-type-windows.zip
gh release upload ${{ needs.release-create.outputs.release }} ./r-type-windows.exe
- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: r-type-windows.zip
path: ./r-type-windows.zip

- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: r-type-windows.exe
path: ./r-type-windows.exe

release-linux:
runs-on: ubuntu-latest
needs: [release-create, raylib-to-tar]
Expand All @@ -78,12 +97,27 @@ jobs:
run: ls -Rl build

- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} ./r-type-linux.tar.gz
gh release upload ${{ needs.release-create.outputs.release }} ./r-type-linux.sh
- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: r-type-linux.tar.gz
path: ./r-type-linux.tar.gz

- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: r-type-linux.sh
path: ./r-type-linux.sh

release-macos:
runs-on: macos-latest
needs: [release-create, raylib-to-tar]
Expand All @@ -102,12 +136,20 @@ jobs:
run: ls -Rl build

- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} ./r-type-macos.zip
# gh release upload ${{ needs.release-create.outputs.release }} ./r-type-linux.sh
- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: r-type-macos.sh
path: ./r-type-macos.sh

raylib-to-tar:
runs-on: ubuntu-latest
needs: release-create
Expand All @@ -131,7 +173,15 @@ jobs:
tar -cvf raylib.tar raylib-repo
- name: Upload To Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-create.outputs.release }} ./raylib.tar
- name: Upload To Artifact
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: raylib.tar
path: ./raylib.tar
2 changes: 2 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

- [CONTRIBUTING](CONTRIBUTING.md)

- [CICD](developer-guide/cicd.md)

- [Common logic](developer-guide/common-logic.md)

- [Network](developer-guide/network/README.md)
Expand Down
21 changes: 21 additions & 0 deletions docs/developer-guide/CICD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CICD

## Compilation test

When you modify the `src` directory, the workflow <https://github.com/X-R-G-B/R-Bus/actions/workflows/compil.yml> will run

## Documentation

When you modify the `docs` directory or `book.tml`, the workflow <https://github.com/X-R-G-B/R-Bus/actions/workflows/documentation.yml> will run

## Format

The code is automatically formatted by the workflow <https://github.com/X-R-G-B/R-Bus/actions/workflows/format.yml> when your create a pull request.

If it can't be automatically formated, please use clang-format with the script `./scripts/format.sh` or `./scripts/format.ps1`

## Release

On the main branch, and the dev branch, the workflow <https://github.com/X-R-G-B/R-Bus/actions/workflows/release.yml> will run

In dev branch it don't push the packaged binary or the source code to a release but in the workflow artifact
Empty file.

0 comments on commit a865f80

Please sign in to comment.