From 5995e588a77d6658f22524cdfe9764e04c8cf219 Mon Sep 17 00:00:00 2001 From: Damien Date: Tue, 6 Aug 2024 20:16:45 +0200 Subject: [PATCH] Adding CI/CD --- .github/workflows/build.yml | 22 +++++++++++++ .github/workflows/release.yml | 60 +++++++++++++++++++++++++++++++++++ LICENCE => LICENSE | 0 README.md | 2 ++ 4 files changed, 84 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml rename LICENCE => LICENSE (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0f84b06 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9ae843d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + tags: + - '*' +env: + CARGO_TERM_COLOR: always + +jobs: + build: + env: + FILE_NAME: flora_parsing + runs-on: ${{ matrix.os }} + permissions: write-all + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest,macOS-latest,windows-latest] + + steps: + - uses: actions/checkout@v4 + - name: Run tests + run: cargo test --verbose + - name: release + run: cargo build --release + + - name: rename + if: matrix.os != 'windows-latest' + run: mv ./target/release/${{ env.FILE_NAME }} ./target/release/${{ matrix.os }}-${{ env.FILE_NAME }} + - name: rename windows + if: matrix.os == 'windows-latest' + run: mv ./target/release/${{ env.FILE_NAME }}.exe ./target/release/${{ matrix.os }}-${{ env.FILE_NAME }}.exe + + - name: upload windows + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-${{ env.FILE_NAME }} + path: ./target/release/${{ matrix.os }}-${{ env.FILE_NAME }}.exe + - uses: actions/upload-artifact@v4 + if: matrix.os != 'windows-latest' + with: + name: ${{ matrix.os }}-flora_parsing + path: ./target/release/${{ matrix.os }}-${{ env.FILE_NAME }} + + release: + needs: build + runs-on: ubuntu-latest + permissions: write-all + strategy: + fail-fast: false + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v4 + - name: Display structure of downloaded files + run: ls -R + - uses: ncipollo/release-action@v1 + with: + artifacts: './ubuntu-latest-flora_parsing/ubuntu-latest-flora_parsing,./macOS-latest-flora_parsing/macOS-latest-flora_parsing,./windows-latest-flora_parsing/windows-latest-flora_parsing.exe' \ No newline at end of file diff --git a/LICENCE b/LICENSE similarity index 100% rename from LICENCE rename to LICENSE diff --git a/README.md b/README.md index 848be69..d9e6347 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,5 @@ For now There is three mode availables: - action_time: Calculate the sum of each actions occurence at each time for every group; - total_action: Calculate the total elapsed time for each action for every group +Inputfile should be a valid MEP-PC .txt file. +Outputfile is an optionnal .txt file. Default to output.txt