Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Builds
on:
push:
branches: [main]
workflow_call:
inputs:
artifact-name:
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:
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

- 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

- name: Install rustup depencencies
run: rustup target add x86_64-unknown-linux-musl

- name: Build release binary
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/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: |
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
continue-on-error: true # optional

- name: Build RPM package
run: cargo generate-rpm --target x86_64-unknown-linux-musl
continue-on-error: true # optional

- name: Upload Debian package
uses: actions/upload-artifact@v4
id: upload-deb
with:
name: ${{ inputs.artifact-name }}deb-package
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/x86_64-unknown-linux-musl/generate-rpm/*
47 changes: 47 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Build doc and deploy to Github pages"

on:
push:
branches: [main]
pull_request:
branches: [main]
types: [closed]

permissions:
contents: read
pages: write
id-token: write

jobs:

build-and-deploy:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
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 --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/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
27 changes: 27 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: End to End tests
on:
workflow_call:
inputs:
artifact-id:
required: true
type: string
jobs:
run-e2e-tests:
runs-on: ubuntu-22.04
steps:
- run: docker info
- name: Download package
uses: actions/download-artifact@v4
with:
artifact-ids: ${{ inputs.artifact-id }}
path: ./deb/
merge-multiple: true
- name: install package
run: |
sudo dpkg -i ./deb/*.deb || true
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
17 changes: 17 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR Build and Tests
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize, edited]

jobs:
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 }}
109 changes: 109 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
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 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest tag
id: version
run: |
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

VERSION=$(yq eval '.package.version' Cargo.toml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: true
body_path: CHANGELOG.md
prerelease: false
release_name: Release ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
env:
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
uses: actions/download-artifact@v4
with:
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: ${{ 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

- name: Download RPM package
uses: actions/download-artifact@v4
with:
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: ${{ steps.find-rpm.outputs.rpm-file }}
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:
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: ./${{ 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
22 changes: 22 additions & 0 deletions .github/workflows/unitest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: unitests
on: [push]
jobs:
run-cargo-unitests:
runs-on: ubuntu-latest
steps:
- run: docker info
- name: Check out repository code
uses: actions/checkout@v5
- 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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading