diff --git a/.github/workflows/compil.yml b/.github/workflows/compil.yml index 30319e93..98a10f99 100644 --- a/.github/workflows/compil.yml +++ b/.github/workflows/compil.yml @@ -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 @@ -24,6 +25,8 @@ jobs: - '.github/workflows/**' src: - 'src/**' + cmake: + - 'CMakeLists.txt' windows-compil: runs-on: windows-latest diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e67c2da5..b4f463d3 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,7 +1,5 @@ name: Documentation -on: - push: - branches: [main, dev] +on: [push] jobs: deploy: @@ -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" @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb84739f..075e48de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: - branches: [main] + branches: [main, feature/RB-52] env: BRANCH: "main" @@ -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 @@ -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] @@ -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] @@ -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 @@ -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 diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index de9a7452..8b89eeb4 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -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) diff --git a/docs/developer-guide/CICD.md b/docs/developer-guide/CICD.md new file mode 100644 index 00000000..7db3c47d --- /dev/null +++ b/docs/developer-guide/CICD.md @@ -0,0 +1,21 @@ +# CICD + +## Compilation test + +When you modify the `src` directory, the workflow will run + +## Documentation + +When you modify the `docs` directory or `book.tml`, the workflow will run + +## Format + +The code is automatically formatted by the workflow 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 will run + +In dev branch it don't push the packaged binary or the source code to a release but in the workflow artifact diff --git a/docs/developer-guide/network-rfc.md b/docs/developer-guide/network-rfc.md deleted file mode 100644 index e69de29b..00000000