diff --git a/.github/workflows/cd_rawrrassembly.yml b/.github/workflows/cd_rawrrassembly.yml new file mode 100644 index 0000000..fd5bfed --- /dev/null +++ b/.github/workflows/cd_rawrrassembly.yml @@ -0,0 +1,93 @@ +name: CD RawrrAssembly +on: + workflow_dispatch: + release: + types: [created] +env: + DOTNET_DOCKER: mcr.microsoft.com/dotnet/sdk:8.0 +jobs: + build: + name: Build Assembly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Pull image + run: docker pull $DOTNET_DOCKER + - name: Build + run: cd inst/rawrrassembly && docker run --rm -v $PWD:/app -w /app $DOTNET_DOCKER /app/build.sh /app /app/out + - name: Publish results + uses: actions/upload-artifact@v4 + with: + name: rawrr + path: inst/rawrrassembly/out + retention-days: 1 + verify-linux: + name: Verify on Linux + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download results + uses: actions/download-artifact@v4 + with: + name: rawrr + - name: List result + run: tree + - name: Make executable + run: chmod +x rawrr-linux-x64 + - name: Execute on test file + run: ./rawrr-linux-x64 ./inst/extdata/sample.raw index + verify-windows: + name: Verify on Windows + runs-on: windows-latest + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download results + uses: actions/download-artifact@v4 + with: + name: rawrr + - name: List result + run: dir + - name: Execute on test file + run: .\rawrr-win-x64.exe .\inst\extdata\sample.raw index + verify-macos: + name: Verify on MacOS + runs-on: macos-latest + needs: build + steps: + - uses: actions/checkout@v4 + - name: Download results + uses: actions/download-artifact@v4 + with: + name: rawrr + - name: List result + run: ls -l + - name: Make executable + run: chmod +x rawrr-osx-x64 + - name: Execute on test file + run: ./rawrr-osx-x64 ./inst/extdata/sample.raw index + upload-release-artifacts: + name: Upload Release Artifacts + runs-on: ubuntu-latest + needs: + - verify-linux + - verify-windows + - verify-macos + if: github.event_name == 'release' + steps: + - uses: actions/checkout@v4 + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + name: rawrr + path: dist + - name: Upload Release Assets + uses: softprops/action-gh-release@v1 + with: + files: | + dist/rawrr-linux-x64 + dist/rawrr-win-x64.exe + dist/rawrr-osx-x64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 81609a2..1f93a4e 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -16,6 +16,10 @@ on: branches: [ devel ] workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: build: runs-on: ubuntu-20.04 diff --git a/inst/rawrrassembly/.gitignore b/inst/rawrrassembly/.gitignore index 9a47a22..a12ad78 100644 --- a/inst/rawrrassembly/.gitignore +++ b/inst/rawrrassembly/.gitignore @@ -1,4 +1,4 @@ -ThermoFisher.CommonCore.Data.dll -ThermoFisher.CommonCore.MassPrecisionEstimator.dll -ThermoFisher.CommonCore.RawFileReader.dll -rawrr.exe +*.dll +*.exe +*.zip +publish diff --git a/inst/rawrrassembly/build.sh b/inst/rawrrassembly/build.sh new file mode 100755 index 0000000..0516864 --- /dev/null +++ b/inst/rawrrassembly/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash +set -euxo pipefail + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi +project_folder="$1" +output_folder="$2" +work_folder="/tmp/build" + +# debug: +#apt-get update && apt-get upgrade -y && apt-get install -y zip tree + +# Checkout the deps +mkdir /tmp/build-dir && cd /tmp/build-dir +git clone --depth=1 https://github.com/thermofisherlsms/RawFileReader.git +dotnet nuget add source "$PWD"/RawFileReader/Libs/NetCore/Net8/ + +# Perform the release +cp -r "$project_folder" "$work_folder" +cd "$work_folder" +runtimes="linux-x64 osx-x64 win-x64" +for runtime in $runtimes; do + dotnet publish --runtime "$runtime" -c Release +done + +# debug: +#tree bin/Release/net8.0 +mkdir -p "$output_folder" + +# Export the result +for runtime in $runtimes; do + source_path="bin/Release/net8.0/$runtime/publish" + suffix="" + if [[ "$runtime" == win-* ]]; then + suffix=".exe" + fi + cp "$source_path/rawrr$suffix" "$output_folder/rawrr-$runtime$suffix" +done diff --git a/inst/rawrrassembly/rawrr.csproj b/inst/rawrrassembly/rawrr.csproj index 5480680..3263411 100644 --- a/inst/rawrrassembly/rawrr.csproj +++ b/inst/rawrrassembly/rawrr.csproj @@ -1,16 +1,18 @@ - Exe - net8.0 rawrr - true - true + net8.0 + true + false + true + true - + +