From d7b23be6bd68d789cf7147c8a7cbdabd1bb911d9 Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 15:52:25 +0400 Subject: [PATCH 1/7] [ADD]:Simple_worklow --- .github/workflows/build.yml | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..83dba68 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,83 @@ +name: Build + +on: + push: + branches: [ main, dev, feature/add-workflow-ci ] + pull_request: + branches: [ main, dev, feature/add-workflow-ci ] + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Configure CMake + run: | + mkdir -p build + cd build + cmake .. \ + -DPARSER_TYPE=CLI11 \ + -DUSE_THREAD_SANITIZER=ON \ + -DUSE_ADDRESS_SANITIZER=OFF + + - name: Build + run: | + cd build + make -j4 + + - name: Test + run: | + cd build + ./ctrace -h + + build-macos: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Configure CMake + run: | + mkdir -p build + cd build + cmake .. \ + -DPARSER_TYPE=CLI11 \ + -DUSE_THREAD_SANITIZER=ON \ + -DUSE_ADDRESS_SANITIZER=OFF + + - name: Build + run: | + cd build + make -j4 + + - name: Test + run: | + cd build + ./ctrace -h + + build-windows: + runs-on: windows-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Configure CMake + run: | + mkdir -p build + cd build + cmake .. \ + -DPARSER_TYPE=CLI11 \ + -DUSE_THREAD_SANITIZER=ON \ + -DUSE_ADDRESS_SANITIZER=OFF + + - name: Build + run: | + cd build + cmake --build . --config Release + + - name: Test + run: | + cd build/Release + ./ctrace.exe -h \ No newline at end of file From 45e4a76e5f04d7597cdd31f55ef62f9072e1f0bd Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 15:55:24 +0400 Subject: [PATCH 2/7] [Remove]: '/' in windows ci --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83dba68..8f27fdb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,10 +67,7 @@ jobs: run: | mkdir -p build cd build - cmake .. \ - -DPARSER_TYPE=CLI11 \ - -DUSE_THREAD_SANITIZER=ON \ - -DUSE_ADDRESS_SANITIZER=OFF + cmake .. -DPARSER_TYPE=CLI11 -DUSE_THREAD_SANITIZER=ON -DUSE_ADDRESS_SANITIZER=OFF - name: Build run: | From ddcd3c99f850092e58b744e9cd55495633c95685 Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 16:03:26 +0400 Subject: [PATCH 3/7] [Release]: remove windows ci and add release for macos and linux --- .github/workflows/build.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f27fdb..d5ecaea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: Build and Release on: push: @@ -32,6 +32,17 @@ jobs: cd build ./ctrace -h + - name: Package Linux Release + run: | + cd build + tar -czf ctrace-linux.tar.gz ctrace + + - name: Upload Linux Artifact + uses: actions/upload-artifact@v3 + with: + name: ctrace-linux + path: build/ctrace-linux.tar.gz + build-macos: runs-on: macos-latest steps: @@ -57,24 +68,13 @@ jobs: cd build ./ctrace -h - build-windows: - runs-on: windows-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Configure CMake - run: | - mkdir -p build - cd build - cmake .. -DPARSER_TYPE=CLI11 -DUSE_THREAD_SANITIZER=ON -DUSE_ADDRESS_SANITIZER=OFF - - - name: Build + - name: Package macOS Release run: | cd build - cmake --build . --config Release - - - name: Test - run: | - cd build/Release - ./ctrace.exe -h \ No newline at end of file + tar -czf ctrace-macos.tar.gz ctrace + + - name: Upload macOS Artifact + uses: actions/upload-artifact@v3 + with: + name: ctrace-macos + path: build/ctrace-macos.tar.gz \ No newline at end of file From 3f1b0677f2ad2e8664b6fb85a591789fcf03027f Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 16:04:47 +0400 Subject: [PATCH 4/7] [Release]: update artifact version --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5ecaea..883446f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: tar -czf ctrace-linux.tar.gz ctrace - name: Upload Linux Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ctrace-linux path: build/ctrace-linux.tar.gz @@ -74,7 +74,7 @@ jobs: tar -czf ctrace-macos.tar.gz ctrace - name: Upload macOS Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ctrace-macos path: build/ctrace-macos.tar.gz \ No newline at end of file From 9f6b396729e26e2fbd375b4564b256c940c10e7e Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 16:11:50 +0400 Subject: [PATCH 5/7] [Release]:test --- .github/workflows/build.yml | 48 ++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 883446f..ce0b8c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build and Release on: push: branches: [ main, dev, feature/add-workflow-ci ] + tags: [ 'v*' ] pull_request: branches: [ main, dev, feature/add-workflow-ci ] @@ -77,4 +78,49 @@ jobs: uses: actions/upload-artifact@v4 with: name: ctrace-macos - path: build/ctrace-macos.tar.gz \ No newline at end of file + path: build/ctrace-macos.tar.gz + + release: + needs: [build-linux, build-macos] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/add-workflow-ci' + steps: + - name: Download Linux Artifact + uses: actions/download-artifact@v4 + with: + name: ctrace-linux + + - name: Download macOS Artifact + uses: actions/download-artifact@v4 + with: + name: ctrace-macos + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name || 'latest' }} + release_name: ctrace ${{ github.ref_name || 'latest' }} + draft: false + prerelease: false + + - name: Upload Linux Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./ctrace-linux.tar.gz + asset_name: ctrace-linux.tar.gz + asset_content_type: application/gzip + + - name: Upload macOS Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./ctrace-macos.tar.gz + asset_name: ctrace-macos.tar.gz + asset_content_type: application/gzip \ No newline at end of file From 541fdc5bf91f08f726c8fd2feaab6e69cb1723cf Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 16:14:59 +0400 Subject: [PATCH 6/7] [Release]:test_v2 --- .github/workflows/build.yml | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce0b8c1..f9651d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,8 @@ jobs: needs: [build-linux, build-macos] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/add-workflow-ci' + permissions: + contents: write steps: - name: Download Linux Artifact uses: actions/download-artifact@v4 @@ -96,31 +98,12 @@ jobs: name: ctrace-macos - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref_name || 'latest' }} - release_name: ctrace ${{ github.ref_name || 'latest' }} + tag_name: ${{ github.ref_name || format('dev-{0}', github.sha) }} + name: ctrace ${{ github.ref_name || format('dev-{0}', github.sha) }} + files: | + ctrace-linux.tar.gz + ctrace-macos.tar.gz draft: false - prerelease: false - - - name: Upload Linux Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./ctrace-linux.tar.gz - asset_name: ctrace-linux.tar.gz - asset_content_type: application/gzip - - - name: Upload macOS Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./ctrace-macos.tar.gz - asset_name: ctrace-macos.tar.gz - asset_content_type: application/gzip \ No newline at end of file + prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }} \ No newline at end of file From 9065e194ef9a89ef8457411439111cb933d79f49 Mon Sep 17 00:00:00 2001 From: Arthurvroum Date: Tue, 8 Jul 2025 16:28:15 +0400 Subject: [PATCH 7/7] [release:v1.2.3] --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9651d5..4951848 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,6 +87,47 @@ jobs: permissions: contents: write steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Generate version number + id: version + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + # Si c'est déjà un tag, utiliser le nom du tag + echo "tag_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT + else + # Vérifier si le message de commit contient un tag spécifié + COMMIT_MSG="${{ github.event.head_commit.message }}" + + # Chercher [tag:vX.X.X] ou [release:vX.X.X] dans le message de commit + if [[ $COMMIT_MSG =~ \[tag:([vV]?[0-9]+\.[0-9]+\.[0-9]+)\] ]]; then + CUSTOM_TAG="${BASH_REMATCH[1]}" + # S'assurer que le tag commence par 'v' + if [[ ! $CUSTOM_TAG =~ ^v ]]; then + CUSTOM_TAG="v${CUSTOM_TAG}" + fi + echo "tag_name=${CUSTOM_TAG}" >> $GITHUB_OUTPUT + echo "Custom tag found: ${CUSTOM_TAG}" + elif [[ $COMMIT_MSG =~ \[release:([vV]?[0-9]+\.[0-9]+\.[0-9]+)\] ]]; then + CUSTOM_TAG="${BASH_REMATCH[1]}" + # S'assurer que le tag commence par 'v' + if [[ ! $CUSTOM_TAG =~ ^v ]]; then + CUSTOM_TAG="v${CUSTOM_TAG}" + fi + echo "tag_name=${CUSTOM_TAG}" >> $GITHUB_OUTPUT + echo "Custom release tag found: ${CUSTOM_TAG}" + else + # Générer un nouveau numéro de version 0.x.0 automatique + COMMIT_COUNT=$(git rev-list --count HEAD) + VERSION="0.${COMMIT_COUNT}.0" + echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT + echo "Auto-generated tag: v${VERSION}" + fi + fi + - name: Download Linux Artifact uses: actions/download-artifact@v4 with: @@ -100,8 +141,8 @@ jobs: - name: Create Release uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref_name || format('dev-{0}', github.sha) }} - name: ctrace ${{ github.ref_name || format('dev-{0}', github.sha) }} + tag_name: ${{ steps.version.outputs.tag_name }} + name: ctrace ${{ steps.version.outputs.tag_name }} files: | ctrace-linux.tar.gz ctrace-macos.tar.gz