Skip to content

Commit b146c08

Browse files
authored
Merge pull request #82 from leoschwarz/setup-initial-cd
Setup CD pipeline for rawrassembly
2 parents efd836c + a4cd8fc commit b146c08

File tree

5 files changed

+148
-9
lines changed

5 files changed

+148
-9
lines changed
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CD RawrrAssembly
2+
on:
3+
workflow_dispatch:
4+
release:
5+
types: [created]
6+
env:
7+
DOTNET_DOCKER: mcr.microsoft.com/dotnet/sdk:8.0
8+
jobs:
9+
build:
10+
name: Build Assembly
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Pull image
15+
run: docker pull $DOTNET_DOCKER
16+
- name: Build
17+
run: cd inst/rawrrassembly && docker run --rm -v $PWD:/app -w /app $DOTNET_DOCKER /app/build.sh /app /app/out
18+
- name: Publish results
19+
uses: actions/upload-artifact@v4
20+
with:
21+
name: rawrr
22+
path: inst/rawrrassembly/out
23+
retention-days: 1
24+
verify-linux:
25+
name: Verify on Linux
26+
runs-on: ubuntu-latest
27+
needs: build
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Download results
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: rawrr
34+
- name: List result
35+
run: tree
36+
- name: Make executable
37+
run: chmod +x rawrr-linux-x64
38+
- name: Execute on test file
39+
run: ./rawrr-linux-x64 ./inst/extdata/sample.raw index
40+
verify-windows:
41+
name: Verify on Windows
42+
runs-on: windows-latest
43+
needs: build
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Download results
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: rawrr
50+
- name: List result
51+
run: dir
52+
- name: Execute on test file
53+
run: .\rawrr-win-x64.exe .\inst\extdata\sample.raw index
54+
verify-macos:
55+
name: Verify on MacOS
56+
runs-on: macos-latest
57+
needs: build
58+
steps:
59+
- uses: actions/checkout@v4
60+
- name: Download results
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: rawrr
64+
- name: List result
65+
run: ls -l
66+
- name: Make executable
67+
run: chmod +x rawrr-osx-x64
68+
- name: Execute on test file
69+
run: ./rawrr-osx-x64 ./inst/extdata/sample.raw index
70+
upload-release-artifacts:
71+
name: Upload Release Artifacts
72+
runs-on: ubuntu-latest
73+
needs:
74+
- verify-linux
75+
- verify-windows
76+
- verify-macos
77+
if: github.event_name == 'release'
78+
steps:
79+
- uses: actions/checkout@v4
80+
- name: Download all artifacts
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: rawrr
84+
path: dist
85+
- name: Upload Release Assets
86+
uses: softprops/action-gh-release@v1
87+
with:
88+
files: |
89+
dist/rawrr-linux-x64
90+
dist/rawrr-win-x64.exe
91+
dist/rawrr-osx-x64
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/r.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
branches: [ devel ]
1717
workflow_dispatch:
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
22+
1923
jobs:
2024
build:
2125
runs-on: ubuntu-20.04

inst/rawrrassembly/.gitignore

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ThermoFisher.CommonCore.Data.dll
2-
ThermoFisher.CommonCore.MassPrecisionEstimator.dll
3-
ThermoFisher.CommonCore.RawFileReader.dll
4-
rawrr.exe
1+
*.dll
2+
*.exe
3+
*.zip
4+
publish

inst/rawrrassembly/build.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
if [ "$#" -ne 2 ]; then
5+
echo "Usage: $0 <project_folder> <output_folder>"
6+
exit 1
7+
fi
8+
project_folder="$1"
9+
output_folder="$2"
10+
work_folder="/tmp/build"
11+
12+
# debug:
13+
#apt-get update && apt-get upgrade -y && apt-get install -y zip tree
14+
15+
# Checkout the deps
16+
mkdir /tmp/build-dir && cd /tmp/build-dir
17+
git clone --depth=1 https://github.com/thermofisherlsms/RawFileReader.git
18+
dotnet nuget add source "$PWD"/RawFileReader/Libs/NetCore/Net8/
19+
20+
# Perform the release
21+
cp -r "$project_folder" "$work_folder"
22+
cd "$work_folder"
23+
runtimes="linux-x64 osx-x64 win-x64"
24+
for runtime in $runtimes; do
25+
dotnet publish --runtime "$runtime" -c Release
26+
done
27+
28+
# debug:
29+
#tree bin/Release/net8.0
30+
mkdir -p "$output_folder"
31+
32+
# Export the result
33+
for runtime in $runtimes; do
34+
source_path="bin/Release/net8.0/$runtime/publish"
35+
suffix=""
36+
if [[ "$runtime" == win-* ]]; then
37+
suffix=".exe"
38+
fi
39+
cp "$source_path/rawrr$suffix" "$output_folder/rawrr-$runtime$suffix"
40+
done

inst/rawrrassembly/rawrr.csproj

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework> <!-- Or net7.0, depending on your setup -->
64
<AssemblyName>rawrr</AssemblyName>
7-
<PublishSingleFile>true</PublishSingleFile>
8-
<SelfContained>true</SelfContained>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<SelfContained>true</SelfContained>
7+
<PublishTrimmed>false</PublishTrimmed>
8+
<PublishSingleFile>true</PublishSingleFile>
9+
<PublishReadyToRun>true</PublishReadyToRun>
910
</PropertyGroup>
1011

1112
<ItemGroup>
1213
<PackageReference Include="ThermoFisher.CommonCore.BackgroundSubtraction" Version="8.0.6" />
13-
<PackageReference Include="Thermofisher.CommonCore.MassPrecisionEstimator" Version="8.0.6" />
14+
<PackageReference Include="ThermoFisher.CommonCore.Data" Version="8.0.6" />
15+
<PackageReference Include="ThermoFisher.CommonCore.MassPrecisionEstimator" Version="8.0.6" />
1416
<PackageReference Include="ThermoFisher.CommonCore.RawFileReader" Version="8.0.6" />
1517
</ItemGroup>
1618
</Project>

0 commit comments

Comments
 (0)