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
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Restore
run: dotnet restore src/Exceltk/Exceltk.csproj

- name: Build
run: dotnet build src/Exceltk/Exceltk.csproj -c Release --no-restore

- name: Regression tests
working-directory: src
run: bash test.sh
37 changes: 7 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
language: csharp
solution: ./src/exceltk.sln

matrix:
include:
- os: linux # Ubuntu 14.04
dist: trusty
sudo: required
dotnet: 2.0.0-preview1-005977
mono: none

script:
- dotnet restore src/exceltk.sln
- dotnet build src/exceltk.sln
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test1.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test2.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test3.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test4.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test5.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test6_crossline.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test7_large_tail_empty_columns.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -xls src/test/test8.xls
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -bhead -xls src/test/test9_formula.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -bhead -xls src/test/test10_bodyhead.xlsx
- dotnet run --project src/Exceltk/Exceltk.csproj -t md -bhead -xls src/test/test11_form.xls


notifications:
email:
- fanfeilong@outlook.com
# Travis CI is retired for this repo.
# Continuous integration now runs on GitHub Actions:
# .github/workflows/ci.yml (.NET 10)
#
# To run the same checks locally:
# dotnet build src/Exceltk/Exceltk.csproj -c Release
# (cd src && bash test.sh)
4 changes: 0 additions & 4 deletions .travisconfig.yml

This file was deleted.

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ExcelTk integrated the following projects

# How to build

Requires [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0).
Requires [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) (LTS). A `global.json` at the repo root pins SDK 10 with `rollForward: latestMajor`.

Quick check (any OS):

Expand All @@ -91,6 +91,8 @@ dotnet run --project src/Exceltk/Exceltk.csproj -c Release -- -t md -xls src/tes

Optional: if `dotnet restore` feels slow because of publish RIDs, you can temporarily remove or comment the `RuntimeIdentifiers` block in `src/Exceltk/Exceltk.csproj`.

CI: GitHub Actions (`.github/workflows/ci.yml`) builds on .NET 10 and runs `src/test.sh`.

## Build on MacOS
```bash
dotnet publish -r osx-x64 src/Exceltk/Exceltk.csproj -c Release
Expand All @@ -102,10 +104,10 @@ dotnet publish -r osx-arm64 src/Exceltk/Exceltk.csproj -c Release
```bash
dotnet publish -r win-x86 src/Exceltk/Exceltk.csproj -c Release
```
You can also open `src/exceltk_vs.sln` in Visual Studio.
Open `src/exceltk.sln` (SDK-style `Exceltk.csproj`) in Visual Studio / VS Code. The legacy `exceltk_vs.sln` / `Exceltk_vs.csproj` (.NET Framework) is obsolete.

## Build on Linux (example: ubuntu / linux-x64)
1. Install the [.NET 8 SDK](https://learn.microsoft.com/dotnet/core/install/linux)
1. Install the [.NET 10 SDK](https://learn.microsoft.com/dotnet/core/install/linux)
2. From the repo root:

```bash
Expand All @@ -118,8 +120,8 @@ dotnet run --project src/Exceltk/Exceltk.csproj -c Release -- -t md -xls src/tes

```bash
dotnet publish -r linux-x64 src/Exceltk/Exceltk.csproj -c Release
# output under: src/bin/net8.0/linux-x64/publish/exceltk
./src/bin/net8.0/linux-x64/publish/exceltk -t md -xls src/test/test1.xlsx
# output under: src/bin/net10.0/linux-x64/publish/exceltk
./src/bin/net10.0/linux-x64/publish/exceltk -t md -xls src/test/test1.xlsx
```

`linux-x64` is the portable RID for Ubuntu and most x64 Linux distros. Other RIDs: https://learn.microsoft.com/dotnet/core/rid-catalog
Expand Down
6 changes: 3 additions & 3 deletions README.zhcn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ exceltk -t md -a r -xls example.xlsx
- 使用 `-sn` 把数字拆分,例如`1234656` 会被拆成`1 2 3 4 5 6`, 如果表太大时有用
# 在 Linux 上构建与使用

需要安装 [.NET 8 SDK](https://learn.microsoft.com/dotnet/core/install/linux)。
需要安装 [.NET 10 SDK](https://learn.microsoft.com/dotnet/core/install/linux)(LTS)。仓库根目录 `global.json` 会约束使用 .NET 10 SDK。

```bash
dotnet build src/Exceltk/Exceltk.csproj -c Release
dotnet run --project src/Exceltk/Exceltk.csproj -c Release -- -t md -xls src/test/test1.xlsx

dotnet publish -r linux-x64 src/Exceltk/Exceltk.csproj -c Release
./src/bin/net8.0/linux-x64/publish/exceltk -t md -xls src/test/test1.xlsx
./src/bin/net10.0/linux-x64/publish/exceltk -t md -xls src/test/test1.xlsx
```

说明:`dotnet run` 传参时请在参数前加 `--`,避免 `-t` / `-a` 被 dotnet 自己吃掉。更多平台说明见英文 README 的 How to build。
说明:`dotnet run` 传参时请在参数前加 `--`,避免 `-t` / `-a` 被 dotnet 自己吃掉。CI 见 `.github/workflows/ci.yml`。更多平台说明见英文 README 的 How to build。
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestMajor"
}
}
17 changes: 4 additions & 13 deletions src/Exceltk/Exceltk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputPath>../bin</OutputPath>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>exceltk</RootNamespace>
<AssemblyName>exceltk</AssemblyName>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -17,19 +19,8 @@
<RuntimeIdentifiers>win-x86;osx-x64;osx-arm64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<None Include="app.config" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="table.ico" />
</ItemGroup>

</Project>
</Project>
7 changes: 0 additions & 7 deletions src/Exceltk/app.config

This file was deleted.

52 changes: 31 additions & 21 deletions src/test.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
#!/bin/bash
dotnet restore
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test1.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test2.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test3.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test4.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test5.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test6_crossline.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test7_large_tail_empty_columns.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test8.xls
dotnet run -p Exceltk/Exceltk.csproj -t md -bhead -xls test/test10_bodyhead.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -bhead -xls test/test9_formula.xlsx
dotnet run -p Exceltk/Exceltk.csproj -t md -bhead -xls test/test11_form.xls
dotnet run -p Exceltk/Exceltk.csproj -t md -xls test/test13_csv.csv
dotnet run -p Exceltk/Exceltk.csproj -t md -csv test/test13_csv.csv
dotnet run -p Exceltk/Exceltk.csproj -- -t md -pretty -xls test/test13_csv.csv
dotnet run -p Exceltk/Exceltk.csproj -- -t md -pretty -a c -xls test/test13_csv.csv
dotnet run -p Exceltk/Exceltk.csproj -- -t md -pretty -a r -xls test/test13_csv.csv
dotnet run -p Exceltk/Exceltk.csproj -- -t md -mmd -xls test/test6_crossline.xlsx
dotnet run -p Exceltk/Exceltk.csproj -- -t md -xls test/test14_late_columns.xlsx
dotnet run -p Exceltk/Exceltk.csproj -- -t md -xls test/test10_nostyles.xlsx
dotnet run -p Exceltk/Exceltk.csproj -- -t md -xls test/test8_issue8_hyperlinks.xlsx
set -euo pipefail

PROJECT=Exceltk/Exceltk.csproj

dotnet restore "$PROJECT"

run() {
# App args after -- so dotnet CLI does not consume -t / -a / etc.
dotnet run --project "$PROJECT" -- "$@"
}

run -t md -xls test/test1.xlsx
run -t md -xls test/test2.xlsx
run -t md -xls test/test3.xlsx
run -t md -xls test/test4.xlsx
run -t md -xls test/test5.xlsx
run -t md -xls test/test6_crossline.xlsx
run -t md -xls test/test7_large_tail_empty_columns.xlsx
run -t md -xls test/test8.xls
run -t md -bhead -xls test/test10_bodyhead.xlsx
run -t md -bhead -xls test/test9_formula.xlsx
run -t md -bhead -xls test/test11_form.xls
run -t md -xls test/test13_csv.csv
run -t md -csv test/test13_csv.csv
run -t md -pretty -xls test/test13_csv.csv
run -t md -pretty -a c -xls test/test13_csv.csv
run -t md -pretty -a r -xls test/test13_csv.csv
run -t md -mmd -xls test/test6_crossline.xlsx
run -t md -xls test/test14_late_columns.xlsx
run -t md -xls test/test10_nostyles.xlsx
run -t md -xls test/test8_issue8_hyperlinks.xlsx
Loading