From 1442adbc2b96fb76d1a95ceadc0fa9158ca5e063 Mon Sep 17 00:00:00 2001 From: mantielero Date: Wed, 20 Dec 2023 20:39:41 +0100 Subject: [PATCH] Create ci-zig --- .github/workflows/ci-zig | 105 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/ci-zig diff --git a/.github/workflows/ci-zig b/.github/workflows/ci-zig new file mode 100644 index 0000000..373f3c7 --- /dev/null +++ b/.github/workflows/ci-zig @@ -0,0 +1,105 @@ +name: Testing examples with FMU Checker +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + nimversion: + - binary:stable + os: + - ubuntu-latest + - windows-latest + + steps: + - uses: actions/checkout@v4 + - uses: iffy/install-nim@v5 + with: + nim-version: ${{ matrix.nimversion }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + #env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: goto-bus-stop/setup-zig@v2 + #- run: zig build test + #- name: Test + # run: | + # nimble install -y + # nimble test + + # - name: Setup MSYS2 (Windows) + # if: ${{matrix.target == 'windows'}} + # uses: msys2/setup-msys2@v2 + # with: + # path-type: inherit + # update: true + # install: base-devel git mingw-w64-x86_64-toolchain + + - name: Install FMU Compliance Checker (linux64) + uses: robinraju/release-downloader@v1.8 + if: runner.os == 'Linux' + with: + repository: "modelica-tools/FMUComplianceChecker" + tag: "2.0.4" + fileName: "FMUChecker-2.0.4-linux64.zip" + extract: true + + - name: Install FMU Compliance Checker (win64) + uses: robinraju/release-downloader@v1.8 + if: runner.os == 'Windows' + with: + repository: "modelica-tools/FMUComplianceChecker" + tag: "2.0.4" + fileName: "FMUChecker-2.0.4-win64.zip" + extract: true + + # chmod +x /home/runner/work/fmu.nim/fmu.nim/FMUChecker-2.0.4-win64/fmuCheck.win64 + - name: Make FMUChecker executable in Linux + run: chmod +x /home/runner/work/fmu.nim/fmu.nim/FMUChecker-2.0.4-linux64/fmuCheck.linux64 + if: runner.os == 'Linux' + + - name: Install zigcc + run: | + nimble install zigcc + + - name: Install fmu.nim + run: | + nimble install -y + + + - name: Create inc.fmu as Model exchange with zig + run: | + cd examples/inc + nim c -r -d:fmu2me -d:zig inc + + - name: Execute FMU checker over inc.fmu in Linux + run: | + cd examples/inc + /home/runner/work/fmu.nim/fmu.nim/FMUChecker-2.0.4-linux64/fmuCheck.linux64 -h 1 -s 14 -f -l 6 -e inc.log -o inc.csv inc.fmu + if: runner.os == 'Linux' + + - name: Set path for windows (working) + shell: bash + run: | + echo "/d/a/fmu.nim/fmu.nim/FMUChecker-2.0.4-win64" >> $GITHUB_PATH + echo "C:\msys64\usr\bin" >> $GITHUB_PATH + if: runner.os == 'Windows' + + - name: Execute FMU checker over inc.fmu in Windows + shell: bash + run: fmuCheck.win64.exe -h 1 -s 14 -f -l 6 -e inc.log -o inc.csv inc.fmu + if: runner.os == 'Windows' + + + # https://github.com/marketplace/actions/smart-diff + - name: Compare the result file + uses: GuillaumeFalourd/diff-action@v1 + with: + first_file_path: examples/inc/inc_me.csv + second_file_path: examples/inc/inc.csv + expected_result: PASSED + + + + + - run: echo "🍏 This job's status is ${{ job.status }}."