From 521a31a141d0f2f5cf57bc5e7c0aafef18d46da1 Mon Sep 17 00:00:00 2001 From: Rhys Goldstein Date: Thu, 19 Dec 2024 11:58:37 -0500 Subject: [PATCH] Simplify continuous integration scripts --- .github/workflows/appVeyor.yml | 115 --------------------------------- .github/workflows/ci.yml | 70 ++++++++++++++++++++ .github/workflows/travis.yml | 93 -------------------------- README.md | 5 +- doxygen.config | 2 +- 5 files changed, 73 insertions(+), 212 deletions(-) delete mode 100644 .github/workflows/appVeyor.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/travis.yml diff --git a/.github/workflows/appVeyor.yml b/.github/workflows/appVeyor.yml deleted file mode 100644 index 4cbcd80d..00000000 --- a/.github/workflows/appVeyor.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Build and Deploy SyDEVS - -on: - push: - tags: - - 'v*' - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - build: - strategy: - matrix: - os: [windows-latest, ubuntu-latest] - runs-on: ${{ matrix.os }} - - steps: - # Step 1: Checkout repository - - name: Checkout Repository - uses: actions/checkout@v3 - - # Step 2: Setup build tools based on OS - - name: Setup Build Tools on Windows - if: runner.os == 'Windows' - run: choco install visualstudio2022buildtools --yes - shell: powershell - - name: Install Dependencies (Ubuntu) - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y build-essential cmake - - # Step 3: Configure Build Environment - - name: Configure Build - run: cmake -S . -B build - shell: bash - - # Step 4: Build Project - - name: Build Project - run: cmake --build build --config Release --parallel - shell: bash - - # Step 5: Prepare Artifacts - - name: Prepare Artifacts - run: | - if [[ "$RUNNER_OS" == "Linux" ]]; then - # Linux-specific commands (Bash) - mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time - cp src/sydevs/core/*.h artifacts/include/sydevs/core || true - cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true - cp src/sydevs/time/*.h artifacts/include/sydevs/time || true - cp build/lib*.so artifacts/lib || cp build/Release/SyDEVS.lib artifacts/lib || true - zip -r artifacts_linux.zip artifacts - elif [[ "$RUNNER_OS" == "Windows" ]]; then - # Windows-specific commands (PowerShell) - pwsh -Command " - New-Item -ItemType Directory -Force -Path artifacts\\lib, artifacts\\include\\sydevs\\core, artifacts\\include\\sydevs\\systems, artifacts\\include\\sydevs\\time; - Copy-Item -Path src\\sydevs\\core\\*.h -Destination artifacts\\include\\sydevs\\core -Force; - Copy-Item -Path src\\sydevs\\systems\\*.h -Destination artifacts\\include\\sydevs\\systems -Force; - Copy-Item -Path src\\sydevs\\time\\*.h -Destination artifacts\\include\\sydevs\\time -Force; - Copy-Item -Path build\\lib*.so -Destination artifacts\\lib -Force; - Copy-Item -Path build\\Release\\SyDEVS.lib -Destination artifacts\\lib -Force; - Compress-Archive -Path artifacts\\* -DestinationPath artifacts_windows.zip - " - fi - shell: bash - - # Step 6: Upload Artifacts for Debugging - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: build-artifacts - path: | - artifacts_linux.zip - artifacts_windows.zip - - deploy: - runs-on: ubuntu-latest - needs: build - if: startsWith(github.ref, 'refs/tags/') - - steps: - # Step 1: Checkout Repository - - name: Checkout Repository - uses: actions/checkout@v3 - - # Step 2: Download Build Artifacts - - name: Download Build Artifacts - uses: actions/download-artifact@v3 - with: - name: build-artifacts - path: ./ - - # Step 3: Create GitHub Release - - name: Create GitHub Release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - # Upload the artifact for Ubuntu - file: artifacts_linux.zip - asset_name: SyDEVS_Release_${{ github.ref_name }}_ubuntu.zip - tag: ${{ github.ref_name }} - overwrite: false - body: "Release for SyDEVS version ${{ github.ref_name }} (Ubuntu build)" - - - name: Create GitHub Release for Windows - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - # Upload the artifact for Windows - file: artifacts_windows.zip - asset_name: SyDEVS_Release_${{ github.ref_name }}_windows.zip - tag: ${{ github.ref_name }} - overwrite: false - body: "Release for SyDEVS version ${{ github.ref_name }} (Windows build)" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6a9533c2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +name: Build and Deploy SyDEVS + +on: + push: + tags: + - 'v*' + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + # Step 1: Checkout repository + - name: Checkout Repository + uses: actions/checkout@v3 + + # Step 2: Setup build tools based on OS + - name: Setup Build Tools on Windows + if: runner.os == 'Windows' + run: choco install visualstudio2022buildtools --yes + shell: powershell + - name: Install Dependencies (Ubuntu) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y build-essential cmake + + # Step 3: Configure build environment + - name: Configure Build + run: cmake -S . -B build + shell: bash + + # Step 4: Build project + - name: Build Project + run: cmake --build build --config Release --parallel + shell: bash + + deploy: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/') + + steps: + # Step 1: Checkout repository + - name: Checkout Repository + uses: actions/checkout@v3 + + # Step 2: Prepare release package + - name: Prepare Artifacts + run: | + sudo apt-get install -y doxygen + (cat doxygen.config; echo "PROJECT_NUMBER=${{ github.ref_name }}") | doxygen - + zip -r SyDEVS-${{ github.ref_name }}.zip doc src CMakeLists.txt CODE_OF_CONDUCT.md CONTRIBUTING.md doxygen.config LICENSE.md README.md + shell: bash + + # Step 3: Deploy release package + - name: Create GitHub Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: SyDEVS-${{ github.ref_name }}.zip + asset_name: SyDEVS-${{ github.ref_name }}.zip + tag: ${{ github.ref_name }} + overwrite: false + body: "Release Package for SyDEVS ${{ github.ref_name }}" diff --git a/.github/workflows/travis.yml b/.github/workflows/travis.yml deleted file mode 100644 index dbea6085..00000000 --- a/.github/workflows/travis.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build and Deploy - -on: - push: - tags: - - 'v*' # Ensure only tags trigger this workflow - pull_request: - branches: - - main - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - cc: [gcc-12, clang-14] # Supported compilers in Ubuntu repositories. - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y software-properties-common - if [[ "${{ matrix.cc }}" == "gcc-12" ]]; then - sudo apt-get install -y g++-12 - export CC=gcc-12 - export CXX=g++-12 - elif [[ "${{ matrix.cc }}" == "clang-14" ]]; then - sudo apt-get install -y clang-14 libc++-14-dev libc++abi-14-dev - export CC=clang-14 - export CXX=clang++-14 - fi - sudo apt-get install -y cmake doxygen graphviz - - - name: Configure with CMake - run: | - mkdir build - cd build - cmake .. - - - name: Build project - run: | - cd build - make - - - name: Generate Documentation - if: github.event_name == 'push' || github.ref == 'refs/tags/*' - run: | - if [ -f doxygen.config ]; then - (cat doxygen.config; echo "PROJECT_NUMBER=${{ github.ref_name }}") | doxygen - - fi - - - name: Archive Artifacts - run: | - mkdir -p artifacts/lib artifacts/include/sydevs/core artifacts/include/sydevs/systems artifacts/include/sydevs/time - if [[ -d src/sydevs/core ]]; then - cp src/sydevs/core/*.h artifacts/include/sydevs/core || true - fi - if [[ -d src/sydevs/systems ]]; then - cp src/sydevs/systems/*.h artifacts/include/sydevs/systems || true - fi - if [[ -d src/sydevs/time ]]; then - cp src/sydevs/time/*.h artifacts/include/sydevs/time || true - fi - if [[ -d build ]]; then - cp build/libSyDEVS* artifacts/lib || true - fi - zip -r "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip" artifacts - - - name: Package Documentation - if: github.event_name == 'push' || github.ref == 'refs/tags/*' - run: | - if [ -d doc/html ]; then - zip -r "SyDEVS-${{ github.ref_name }}_api-reference.zip" doc/html - fi - - - name: Create GitHub Release (Compiler-specific) - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip" - asset_name: "SyDEVS-${{ github.ref_name }}-${{ matrix.cc }}.zip" - tag: ${{ github.ref_name }} # Use cleaned tag name - overwrite: false - body: "Release for SyDEVS version ${{ github.ref_name }} using compiler ${{ matrix.cc }}" - - - name: Deploy Documentation - if: github.event_name == 'push' || github.ref == 'refs/tags/*' - run: bash scripts/deploy_docs.sh diff --git a/README.md b/README.md index cef55a41..4e36a8b5 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,9 @@ You should update the documentation on a regular basis to keep it in sync with t When releasing a new version of SyDEVS, remember to perform the following steps: -1. In [doxygen.config](doxygen.config), update the `PROJECT_NUMBER`. -1. Ensure the change above is merged into the `main` branch of the repo. 1. Create the new release. -1. Generate the API documentation, and copy the contents of `doc/html`. +1. Wait for the package `SyDEVS-[version].zip` to appear as a release asset. +1. Unzip the package and copy the contents of `doc/html`. 1. Checkout the `gh-pages` branch of the repo. 1. In the `gh-pages` branch, replace the contents of `doc/html` with the contents copied above. diff --git a/doxygen.config b/doxygen.config index 0e4d4f59..e9f32664 100644 --- a/doxygen.config +++ b/doxygen.config @@ -38,7 +38,7 @@ PROJECT_NAME = SyDEVS # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.7 (under development) +PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a