From 3a55ced819dfda5c19d767bfa75d1949c8b419dd Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 11:34:53 +0200 Subject: [PATCH 01/23] add basic actions --- .github/workflows/build.yml | 20 ++++++++++++++++++++ .github/workflows/unitest.yml | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/unitest.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c7388fc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Builds +run-name: Build all the binaries and distributions +on: [push] +jobs: + build-debian-binary: + runs-on: debian-latest + container: + image: rust:bullseye + steps: + - name: Check out repository code + uses: actions/checkout@v5 + - run: cd ${{ github.workspace }} + - run: apt update && apt install protobuf-compiler -y + - run: cargo build --release + # Upload the compiled binary as an artifact + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: compiled-binary + path: target/release/* \ No newline at end of file diff --git a/.github/workflows/unitest.yml b/.github/workflows/unitest.yml new file mode 100644 index 0000000..f3610cc --- /dev/null +++ b/.github/workflows/unitest.yml @@ -0,0 +1,7 @@ +name: unitests +on: [push] +jobs: + run-cargo-unitests: + runs-on: ubuntu-latest + steps: + - run: docker info \ No newline at end of file From a1a4969220312dae3c68e3407850751aa6a0c248 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 11:39:06 +0200 Subject: [PATCH 02/23] add unitest --- .github/workflows/unitest.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unitest.yml b/.github/workflows/unitest.yml index f3610cc..4db3191 100644 --- a/.github/workflows/unitest.yml +++ b/.github/workflows/unitest.yml @@ -4,4 +4,20 @@ jobs: run-cargo-unitests: runs-on: ubuntu-latest steps: - - run: docker info \ No newline at end of file + - run: docker info + - name: Check out repository code + uses: actions/checkout@v5 + - run: cd ${{ github.workspace }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y pkg-config libssl-dev protobuf-compiler + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Pull Docker image + run: docker pull simvia/code_aster:17.3.1 + - name: Run tests + run: cargo test \ No newline at end of file From 8536bc667b291622e65d6f8b433c4a3adef7c377 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 11:43:07 +0200 Subject: [PATCH 03/23] fix build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7388fc..a21c660 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ run-name: Build all the binaries and distributions on: [push] jobs: build-debian-binary: - runs-on: debian-latest + runs-on: ubuntu-latest container: image: rust:bullseye steps: From 7629eb95a2c5c7053dce6bf29ac016d73611fccd Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 11:54:50 +0200 Subject: [PATCH 04/23] ci work --- .github/workflows/build.yml | 1 - .github/workflows/doc.yml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/unitest.yml | 1 - 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/doc.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a21c660..8b83d90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v5 - - run: cd ${{ github.workspace }} - run: apt update && apt install protobuf-compiler -y - run: cargo build --release # Upload the compiled binary as an artifact diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 0000000..9d71384 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,40 @@ +name: "Build and deploy Github pages" + +on: + push: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + + build-and-deploy: + runs-on: ubuntu-latest + steps: + + - name: "Checkout" + uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y pkg-config libssl-dev protobuf-compiler + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: build doc + run: cargo doc + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './target/doc/cave/' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/unitest.yml b/.github/workflows/unitest.yml index 4db3191..b42d26d 100644 --- a/.github/workflows/unitest.yml +++ b/.github/workflows/unitest.yml @@ -7,7 +7,6 @@ jobs: - run: docker info - name: Check out repository code uses: actions/checkout@v5 - - run: cd ${{ github.workspace }} - name: Install dependencies run: | sudo apt-get update From 02f047251a9a7c2ef7c28552918eac1e58c4f518 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 13:31:23 +0200 Subject: [PATCH 05/23] redirect doc to /cave/ --- .github/workflows/doc.yml | 6 ++++-- assets/index.html | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 assets/index.html diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 9d71384..d9a2087 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -28,13 +28,15 @@ jobs: toolchain: stable override: true - name: build doc - run: cargo doc + run: cargo doc --no-deps --release + - name: add index file + run: cp assets/index.html target/doc/index.html - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: './target/doc/cave/' + path: './target/doc/' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 0000000..60bc8b9 --- /dev/null +++ b/assets/index.html @@ -0,0 +1,12 @@ + + + + + Redirecting... + + + + +

Redirecting to cave docs...

+ + \ No newline at end of file From 3b84e4a74f526f2fa09d3da197e5143f5f63e3f8 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 13:51:54 +0200 Subject: [PATCH 06/23] maj pipelines --- .github/workflows/build.yml | 21 ++++++++++++++++++--- .github/workflows/doc.yml | 2 +- Cargo.toml | 3 +-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b83d90..ea55659 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Builds run-name: Build all the binaries and distributions on: [push] jobs: - build-debian-binary: + build-binary-and-package: runs-on: ubuntu-latest container: image: rust:bullseye @@ -11,9 +11,24 @@ jobs: uses: actions/checkout@v5 - run: apt update && apt install protobuf-compiler -y - run: cargo build --release - # Upload the compiled binary as an artifact - name: Upload binary uses: actions/upload-artifact@v4 with: name: compiled-binary - path: target/release/* \ No newline at end of file + path: target/release/* + - name: intall cargo dependencies + run: cargo install cargo-deb cargo-generate-rpm + - name: build debian packages + run: cargo deb + - name: build rpm packages + run: cargo generate-rpm + - name: Upload deb_package + uses: actions/upload-artifact@v4 + with: + name: deb-package + path: target/debian/* + - name: Upload rpm_package + uses: actions/upload-artifact@v4 + with: + name: rpm-package + path: target/generate-rpm/* \ No newline at end of file diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index d9a2087..616f51e 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -1,4 +1,4 @@ -name: "Build and deploy Github pages" +name: "Build doc and deploy to Github pages" on: push: diff --git a/Cargo.toml b/Cargo.toml index 063b857..5e376df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cave" version = "0.1.0" -authors = ["Simvia "] +authors = ["Simvia "] edition = "2021" description = "CLI for managing code_aster versions" license = "MIT" @@ -39,7 +39,6 @@ assets = [ ["target/release/cave", "usr/bin/", "755"], ["man/cave.1", "usr/share/man/man1/", "644"] ] -depends = ["protobuf-compiler"] [package.metadata.generate-rpm] assets = [ From 3215f9e855589fe6cb80ecc578b368fdb84eb574 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 14:06:49 +0200 Subject: [PATCH 07/23] add end to end testing --- .github/workflows/build.yml | 1 - .github/workflows/e2e.yml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea55659..6aecd2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,4 @@ name: Builds -run-name: Build all the binaries and distributions on: [push] jobs: build-binary-and-package: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..e82c416 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,21 @@ +name: End to End tests +on: [push] +jobs: + run-e2e-tests: + runs-on: ubuntu-latest + steps: + - run: docker info + - name: Download package + uses: actions/download-artifact@v4 + with: + name: deb-package + path: ./ + - name: install package + run: | + sudo dpkg -i target/debian/cave* + sudo apt-get update + sudo apt-get -f install -y + - name: display cave help + run: cave help + - name: display all cave versions + run: cave available \ No newline at end of file From ffa34506547cf089fb2a79106f18fa38765da6c8 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 14:28:34 +0200 Subject: [PATCH 08/23] add a release stage --- .github/workflows/release.yml | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..edade1d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: create release +on: + workflow_call: +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # fetch all history + tags + - name: Get latest tag + id: version + run: | + # Use git to find the most recent reachable tag + latest_tag=$(git describe --tags --abbrev=0) + echo "last_tag=$latest_tag" >> $GITHUB_OUTPUT + - name: release + uses: actions/create-release@v1 + id: create_release + with: + draft: true + prerelease: false + release_name: Release ${{ steps.version.outputs.version }} + tag_name: ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ github.token }} + upload-artifacts: + runs-on: ubuntu-latest + needs: create-release + steps: + - name: Download package + uses: actions/download-artifact@v4 + with: + name: deb-package + path: ./deb/ + - name: upload linux artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./deb/*.deb + asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.deb + asset_content_type: application/vnd.debian.binary-package + + - name: Download RPM package + uses: actions/download-artifact@v4 + with: + name: rpm-package + path: ./rpm/ + - name: Upload RPM release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./rpm/*.rpm + asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.rpm + asset_content_type: application/x-rpm + + - name: Download binary + uses: actions/download-artifact@v4 + with: + name: compiled-binary + path: ./bin/ + - name: Create tarball of bin + run: tar -czf compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . + - name: Upload binary tarball + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz + asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.tar.gz + asset_content_type: application/gzip \ No newline at end of file From 14aacd76131ae208afe2e2f6ec39ff310ee2b89c Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:03:48 +0200 Subject: [PATCH 09/23] try this --- .github/workflows/build.yml | 53 ++++++++++++++++++++++++++--------- .github/workflows/doc.yml | 4 +++ .github/workflows/e2e.yml | 9 ++++-- .github/workflows/pr.yml | 18 ++++++++++++ .github/workflows/release.yml | 15 ++++++---- 5 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6aecd2e..534b57d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,33 +1,60 @@ name: Builds -on: [push] +on: + push: + workflow_call: + inputs: + artifact-name: + description: Base name for uploaded artifacts + required: true + type: string + jobs: build-binary-and-package: runs-on: ubuntu-latest + outputs: + deb-artifact: ${{ steps.upload-deb.outputs.artifact-id }} + rpm-artifact: ${{ steps.upload-rpm.outputs.artifact-id }} + bin-artifact: ${{ steps.upload-bin.outputs.artifact-id }} container: image: rust:bullseye steps: - name: Check out repository code uses: actions/checkout@v5 - - run: apt update && apt install protobuf-compiler -y - - run: cargo build --release - - name: Upload binary + + - name: Install system dependencies + run: apt-get update && apt-get install -y protobuf-compiler + + - name: Build release binary + run: cargo build --release + + - name: Upload compiled binary uses: actions/upload-artifact@v4 + id: upload-bin with: - name: compiled-binary - path: target/release/* - - name: intall cargo dependencies + name: ${{ inputs.artifact-name }}compiled-binary + path: target/release/* + + - name: Install cargo packaging tools run: cargo install cargo-deb cargo-generate-rpm - - name: build debian packages + + - name: Build Debian package run: cargo deb - - name: build rpm packages + continue-on-error: true # optional + + - name: Build RPM package run: cargo generate-rpm - - name: Upload deb_package + continue-on-error: true # optional + + - name: Upload Debian package uses: actions/upload-artifact@v4 + id: upload-deb with: - name: deb-package + name: ${{ inputs.artifact-name }}deb-package path: target/debian/* - - name: Upload rpm_package + + - name: Upload RPM package uses: actions/upload-artifact@v4 + id: upload-rpm with: - name: rpm-package + name: ${{ inputs.artifact-name }}rpm-package path: target/generate-rpm/* \ No newline at end of file diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 616f51e..3a41d48 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -2,6 +2,10 @@ name: "Build doc and deploy to Github pages" on: push: + branches: [main] + pull_request: + branches: [main] + types: [closed] permissions: contents: read diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e82c416..368b812 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,5 +1,10 @@ name: End to End tests -on: [push] +on: + workflow_call: + inputs: + artifact-id: + required: true + type: string jobs: run-e2e-tests: runs-on: ubuntu-latest @@ -8,7 +13,7 @@ jobs: - name: Download package uses: actions/download-artifact@v4 with: - name: deb-package + artifact-id: ${{ inputs.artifact-id }} path: ./ - name: install package run: | diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..2147a61 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,18 @@ +name: PR Build and Tests + +on: + pull_request: + branches: [main] + types: [opened, reopened, synchronize, edited] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/build.yml + id: build + with: + artifact-name: pr + - uses: ./.github/workflows/e2e.yml + with: + artifact-id: ${{ steps.build.outputs.deb-artifact }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index edade1d..ef12971 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,12 @@ name: create release on: - workflow_call: + push: + jobs: + build: + uses: ./.github/workflows/build.yml + with: + artifact-name: release create-release: runs-on: ubuntu-latest outputs: @@ -30,12 +35,12 @@ jobs: GITHUB_TOKEN: ${{ github.token }} upload-artifacts: runs-on: ubuntu-latest - needs: create-release + needs: [create-release,build] steps: - name: Download package uses: actions/download-artifact@v4 with: - name: deb-package + artifact-id: ${{ needs.build.outputs.deb-artifact }} path: ./deb/ - name: upload linux artifact uses: actions/upload-release-asset@v1 @@ -50,7 +55,7 @@ jobs: - name: Download RPM package uses: actions/download-artifact@v4 with: - name: rpm-package + artifact-id: ${{ needs.build.outputs.rpm-artifact }} path: ./rpm/ - name: Upload RPM release asset uses: actions/upload-release-asset@v1 @@ -65,7 +70,7 @@ jobs: - name: Download binary uses: actions/download-artifact@v4 with: - name: compiled-binary + artifact-id: ${{ needs.build.outputs.bin-artifact }} path: ./bin/ - name: Create tarball of bin run: tar -czf compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . From 8d29ee664a7fc39994ee626d7e2b04eaffec7f38 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:09:48 +0200 Subject: [PATCH 10/23] fix pr tests --- .github/workflows/pr.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2147a61..9d0e383 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -6,13 +6,12 @@ on: types: [opened, reopened, synchronize, edited] jobs: - build-and-test: - runs-on: ubuntu-latest - steps: - - uses: ./.github/workflows/build.yml - id: build - with: - artifact-name: pr - - uses: ./.github/workflows/e2e.yml - with: - artifact-id: ${{ steps.build.outputs.deb-artifact }} \ No newline at end of file + build: + uses: ./.github/workflows/build.yml + with: + artifact-name: release + test: + uses: ./.github/workflows/e2e.yml + needs: [build] + with: + artifact-id: ${{ needs.build.outputs.deb-artifact }} \ No newline at end of file From 2f704f95cfff7a43de4888792428c90a02b9a01a Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:11:46 +0200 Subject: [PATCH 11/23] correct triggers --- .github/workflows/build.yml | 1 + .github/workflows/release.yml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 534b57d..1c7139d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Builds on: push: + branches: [main] workflow_call: inputs: artifact-name: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef12971..c191c60 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,8 @@ name: create release on: - push: + pull_request: + branches: [main] + types: [closed] jobs: build: From 61fa7de39a3bb505fb2bde76f2f290024e42e31f Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:19:02 +0200 Subject: [PATCH 12/23] fix typo --- .github/workflows/e2e.yml | 6 +++--- .github/workflows/release.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 368b812..58eeda5 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -13,11 +13,11 @@ jobs: - name: Download package uses: actions/download-artifact@v4 with: - artifact-id: ${{ inputs.artifact-id }} - path: ./ + artifact-ids: ${{ inputs.artifact-id }} + path: ./deb/ - name: install package run: | - sudo dpkg -i target/debian/cave* + sudo dpkg -i ./deb/*.deb sudo apt-get update sudo apt-get -f install -y - name: display cave help diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c191c60..4f37841 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: - name: Download package uses: actions/download-artifact@v4 with: - artifact-id: ${{ needs.build.outputs.deb-artifact }} + artifact-ids: ${{ needs.build.outputs.deb-artifact }} path: ./deb/ - name: upload linux artifact uses: actions/upload-release-asset@v1 @@ -57,7 +57,7 @@ jobs: - name: Download RPM package uses: actions/download-artifact@v4 with: - artifact-id: ${{ needs.build.outputs.rpm-artifact }} + artifact-ids: ${{ needs.build.outputs.rpm-artifact }} path: ./rpm/ - name: Upload RPM release asset uses: actions/upload-release-asset@v1 @@ -72,7 +72,7 @@ jobs: - name: Download binary uses: actions/download-artifact@v4 with: - artifact-id: ${{ needs.build.outputs.bin-artifact }} + artifact-ids: ${{ needs.build.outputs.bin-artifact }} path: ./bin/ - name: Create tarball of bin run: tar -czf compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . From ae911c4f167a9c41880808c334a00411cdde0c2e Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:22:10 +0200 Subject: [PATCH 13/23] add changelog body --- .github/workflows/release.yml | 3 +-- CHANGELOG.md | 0 2 files changed, 1 insertion(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f37841..4919540 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,8 +17,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 # fetch all history + tags - name: Get latest tag id: version run: | @@ -30,6 +28,7 @@ jobs: id: create_release with: draft: true + body_path: CHANGELOG.md prerelease: false release_name: Release ${{ steps.version.outputs.version }} tag_name: ${{ github.ref }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 From e8d785d951b6e679d668e38db3c9cb429ed6cb10 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:33:09 +0200 Subject: [PATCH 14/23] fiw workflows --- .github/workflows/build.yml | 10 ++++++++++ .github/workflows/pr.yml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c7139d..102a6d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,16 @@ on: description: Base name for uploaded artifacts required: true type: string + outputs: + deb-artifact: + description: "Debian package artifact ID" + value: ${{ jobs.build-binary-and-package.outputs.deb-artifact }} + rpm-artifact: + description: "RPM package artifact ID" + value: ${{ jobs.build-binary-and-package.outputs.rpm-artifact }} + bin-artifact: + description: "Binary artifact ID" + value: ${{ jobs.build-binary-and-package.outputs.bin-artifact }} jobs: build-binary-and-package: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9d0e383..7e74cfb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,5 +1,4 @@ name: PR Build and Tests - on: pull_request: branches: [main] @@ -10,6 +9,7 @@ jobs: uses: ./.github/workflows/build.yml with: artifact-name: release + test: uses: ./.github/workflows/e2e.yml needs: [build] From 21005fe59a13e1ace7f8d7a0c25535dbb548b885 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:33:20 +0200 Subject: [PATCH 15/23] fix trigger --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4919540..d89fa9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: create release on: pull_request: branches: [main] - types: [closed] jobs: build: From 2c1bb31090fc3d74f5bf0675ad7b1a7baae07808 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:43:08 +0200 Subject: [PATCH 16/23] fix release --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d89fa9d..c83ff0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,9 +19,12 @@ jobs: - name: Get latest tag id: version run: | - # Use git to find the most recent reachable tag - latest_tag=$(git describe --tags --abbrev=0) - echo "last_tag=$latest_tag" >> $GITHUB_OUTPUT + apt update && apt install -y wget + wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 + chmod +x /usr/local/bin/yq + + VERSION=$(yq eval '.package.version' Cargo.toml) + echo "version=$VERSION" >> $GITHUB_OUTPUT - name: release uses: actions/create-release@v1 id: create_release From 1fe9f42785214a0aa259753262ba2becc352f549 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:47:00 +0200 Subject: [PATCH 17/23] fix e2e --- .github/workflows/e2e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 58eeda5..02b8b2b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -15,6 +15,7 @@ jobs: with: artifact-ids: ${{ inputs.artifact-id }} path: ./deb/ + merge-multiple: true - name: install package run: | sudo dpkg -i ./deb/*.deb From 02cd60fb9c205bc80c571a3c61963ac96fd88093 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:48:44 +0200 Subject: [PATCH 18/23] fix release --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c83ff0f..2f67f80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,7 @@ jobs: with: artifact-ids: ${{ needs.build.outputs.deb-artifact }} path: ./deb/ + merge-multiple: true - name: upload linux artifact uses: actions/upload-release-asset@v1 env: @@ -60,6 +61,7 @@ jobs: with: artifact-ids: ${{ needs.build.outputs.rpm-artifact }} path: ./rpm/ + merge-multiple: true - name: Upload RPM release asset uses: actions/upload-release-asset@v1 env: @@ -75,6 +77,7 @@ jobs: with: artifact-ids: ${{ needs.build.outputs.bin-artifact }} path: ./bin/ + merge-multiple: true - name: Create tarball of bin run: tar -czf compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . - name: Upload binary tarball From 54b41692bd5ca1d6c8e0afb5c2e004b586241537 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 15:56:05 +0200 Subject: [PATCH 19/23] i hope it will work --- .github/workflows/e2e.yml | 2 +- .github/workflows/release.yml | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 02b8b2b..48a6593 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -18,7 +18,7 @@ jobs: merge-multiple: true - name: install package run: | - sudo dpkg -i ./deb/*.deb + sudo dpkg -i ./deb/*.deb || true sudo apt-get update sudo apt-get -f install -y - name: display cave help diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f67f80..3fa67e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./deb/*.deb + asset_path: ./deb asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.deb asset_content_type: application/vnd.debian.binary-package @@ -68,7 +68,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./rpm/*.rpm + asset_path: ./rpm asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.rpm asset_content_type: application/x-rpm @@ -78,14 +78,12 @@ jobs: artifact-ids: ${{ needs.build.outputs.bin-artifact }} path: ./bin/ merge-multiple: true - - name: Create tarball of bin - run: tar -czf compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . - name: Upload binary tarball uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./compiled-binary_${{ needs.create-release.outputs.version }}.tar.gz + asset_path: ./bin asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.tar.gz asset_content_type: application/gzip \ No newline at end of file From 5409624a085559b03a7f9d6170386981a8b4c77c Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 17:16:43 +0200 Subject: [PATCH 20/23] fix --- .github/workflows/e2e.yml | 2 +- .github/workflows/release.yml | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 48a6593..a9f6e74 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,7 +7,7 @@ on: type: string jobs: run-e2e-tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - run: docker info - name: Download package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fa67e6..2a6aa67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,13 +46,18 @@ jobs: artifact-ids: ${{ needs.build.outputs.deb-artifact }} path: ./deb/ merge-multiple: true + + - name: Find deb file + id: find-deb + run: echo "deb-file=$(find ./deb -name '*.deb' -type f | head -n1)" >> $GITHUB_OUTPUT + - name: upload linux artifact uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./deb + asset_path: ${{ steps.find-deb.outputs.deb-file }} asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.deb asset_content_type: application/vnd.debian.binary-package @@ -62,13 +67,18 @@ jobs: artifact-ids: ${{ needs.build.outputs.rpm-artifact }} path: ./rpm/ merge-multiple: true + + - name: Find RPM file + id: find-rpm + run: echo "rpm-file=$(find ./rpm -name '*.rpm' -type f | head -n1)" >> $GITHUB_OUTPUT + - name: Upload RPM release asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./rpm + asset_path: ${{ steps.find-rpm.outputs.rpm-file }} asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.rpm asset_content_type: application/x-rpm @@ -78,12 +88,16 @@ jobs: artifact-ids: ${{ needs.build.outputs.bin-artifact }} path: ./bin/ merge-multiple: true + + - name: Create binary tarball + run: tar -czf ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.tar.gz -C ./bin . + - name: Upload binary tarball uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: ./bin + asset_path: ./${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.tar.gz asset_name: ${{ github.event.repository.name }}_${{ needs.create-release.outputs.version }}.tar.gz asset_content_type: application/gzip \ No newline at end of file From 1c938c850afb97b460c868b54b974f749d7ad74e Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 17:22:47 +0200 Subject: [PATCH 21/23] fix release --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a6aa67..9cddf88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,9 @@ jobs: - name: Get latest tag id: version run: | - apt update && apt install -y wget + sudo apt-get update -y + sudo apt-get install -y wget + wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 chmod +x /usr/local/bin/yq From 29ec837490021b1af5ff22dff1fcfce25abe73c0 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 18:05:27 +0200 Subject: [PATCH 22/23] this one is the good one --- .github/workflows/build.yml | 17 ++++++++++------- CHANGELOG.md | 16 ++++++++++++++++ Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 102a6d1..0d89604 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,27 +33,30 @@ jobs: uses: actions/checkout@v5 - name: Install system dependencies - run: apt-get update && apt-get install -y protobuf-compiler + run: apt-get update && apt-get install -y protobuf-compiler musl musl-dev musl-tools pkg-config + + - name: Install rustup depencencies + run: rustup target add x86_64-unknown-linux-musl - name: Build release binary - run: cargo build --release + run: cargo build --release --target x86_64-unknown-linux-musl - name: Upload compiled binary uses: actions/upload-artifact@v4 id: upload-bin with: name: ${{ inputs.artifact-name }}compiled-binary - path: target/release/* + path: target/x86_64-unknown-linux-musl/release/cave - name: Install cargo packaging tools run: cargo install cargo-deb cargo-generate-rpm - name: Build Debian package - run: cargo deb + run: cargo deb --target x86_64-unknown-linux-musl continue-on-error: true # optional - name: Build RPM package - run: cargo generate-rpm + run: cargo generate-rpm --target x86_64-unknown-linux-musl continue-on-error: true # optional - name: Upload Debian package @@ -61,11 +64,11 @@ jobs: id: upload-deb with: name: ${{ inputs.artifact-name }}deb-package - path: target/debian/* + path: target/x86_64-unknown-linux-musl/debian/* - name: Upload RPM package uses: actions/upload-artifact@v4 id: upload-rpm with: name: ${{ inputs.artifact-name }}rpm-package - path: target/generate-rpm/* \ No newline at end of file + path: target/x86_64-unknown-linux-musl/generate-rpm/* \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..142d42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# CAVE (Code_Aster VErsioning tool) first official version ! + +This version has been tested* on : + +- debian 12.12 +- debian 11.11 +- ubuntu 22.04 +- ubuntu 24.04 +- ubuntu 25.03 +- fedora 41 +- fedora 42 +- fedora 43 +- fedora 44 +- Red Hat Enterprise Linux 8 + +> *We have tested CAVE, not the underlying code_aster \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index ecfc38e..020efee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -266,6 +266,7 @@ dependencies = [ "clap_mangen", "colored", "dirs", + "openssl", "predicates 2.1.5", "prost", "regex", @@ -1137,6 +1138,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-src" +version = "300.5.2+3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d270b79e2926f5150189d475bc7e9d2c69f9c4697b185fa917d5a32b792d21b4" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.109" @@ -1145,6 +1155,7 @@ checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cargo.toml b/Cargo.toml index 5e376df..b59c962 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ description = "CLI for managing code_aster versions" license = "MIT" [dependencies] +openssl = { version = "0.10", features = ["vendored"] } clap = { version = "4.5.21", features = ["derive"] } anyhow = "1.0" regex = "1.11.1" From c1cd3453e26318de4b1dff422166c4435f6ef2e8 Mon Sep 17 00:00:00 2001 From: SIMVIA-lucas-sovre Date: Thu, 25 Sep 2025 18:16:32 +0200 Subject: [PATCH 23/23] finalize --- .github/workflows/build.yml | 32 +++++++++++++++++++++++++++++++- .github/workflows/doc.yml | 1 + .github/workflows/release.yml | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d89604..b67561a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,25 @@ jobs: - name: Check out repository code uses: actions/checkout@v5 + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo target + uses: actions/cache@v4 + with: + path: target/ + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-target- + - name: Install system dependencies run: apt-get update && apt-get install -y protobuf-compiler musl musl-dev musl-tools pkg-config @@ -48,8 +67,19 @@ jobs: name: ${{ inputs.artifact-name }}compiled-binary path: target/x86_64-unknown-linux-musl/release/cave + - name: Cache cargo tools + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/ + key: ${{ runner.os }}-cargo-tools-${{ hashFiles('**/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo-tools- + - name: Install cargo packaging tools - run: cargo install cargo-deb cargo-generate-rpm + run: | + if ! command -v cargo-deb &> /dev/null || ! command -v cargo-generate-rpm &> /dev/null; then + cargo install cargo-deb cargo-generate-rpm + fi - name: Build Debian package run: cargo deb --target x86_64-unknown-linux-musl diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 3a41d48..5697cd9 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -16,6 +16,7 @@ jobs: build-and-deploy: runs-on: ubuntu-latest + if: github.event.pull_request.merged == true steps: - name: "Checkout" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9cddf88..d4d362e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,14 +2,17 @@ name: create release on: pull_request: branches: [main] + types: [closed] jobs: build: uses: ./.github/workflows/build.yml + if: github.event.pull_request.merged == true with: artifact-name: release create-release: runs-on: ubuntu-latest + if: github.event.pull_request.merged == true outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} version: ${{ steps.version.outputs.version }} @@ -40,6 +43,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} upload-artifacts: runs-on: ubuntu-latest + if: github.event.pull_request.merged == true needs: [create-release,build] steps: - name: Download package