-
Notifications
You must be signed in to change notification settings - Fork 4
137 lines (121 loc) · 5.09 KB
/
Copy pathpack.yml
File metadata and controls
137 lines (121 loc) · 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: pack
on:
push:
branches:
- master
- develop
pull_request:
permissions:
contents: read
jobs:
pack:
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.version.outputs.version }}
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Compute package version
id: version
shell: bash
run: |
set -euo pipefail
base_version=$(grep -m1 '<Version>' src/typstsharp/typstsharp.csproj | sed -E 's/.*<Version>(.+)<\/Version>.*/\1/')
branch="${GITHUB_REF_NAME:-}"
if [ -z "$branch" ] && [ -n "${GITHUB_HEAD_REF:-}" ]; then
branch="$GITHUB_HEAD_REF"
fi
if [ "$branch" != "master" ]; then
package_version="${base_version}-preview.${GITHUB_RUN_NUMBER}"
else
package_version="$base_version"
fi
echo "Base version: $base_version"
echo "Branch: ${branch:-unknown}"
echo "Using package version: $package_version"
echo "PACKAGE_VERSION=$package_version" >> "$GITHUB_ENV"
echo "version=$package_version" >> "$GITHUB_OUTPUT"
- name: Build package
uses: ./.github/actions/build-pack
with:
package-version: ${{ env.PACKAGE_VERSION }}
# The Rust tests cover the FFI entry points directly. That is the only place a
# panic crossing the boundary shows up as a failing test rather than as a
# crashed test runner, so they have to run in their own right.
- name: Run native tests
shell: bash
run: cargo test --manifest-path src/typst_core/Cargo.toml --release
- name: Run tests
shell: bash
run: dotnet test --solution typstsharp.slnx
- name: Upload NuGet artifact
uses: actions/upload-artifact@v7
with:
name: typstsharp-${{ env.PACKAGE_VERSION }}
path: artifacts
test-package:
needs: pack
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
- name: Ubuntu
os: ubuntu-latest
- name: Alpine (musl)
os: ubuntu-latest
test_type: docker-alpine
- name: Fedora (new glibc)
os: ubuntu-latest
test_type: docker-fedora
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Download package artifacts
uses: actions/download-artifact@v7
with:
name: typstsharp-${{ needs.pack.outputs.package_version }}
path: artifacts
- name: Install .NET SDK
if: matrix.test_type == ''
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
- name: Run tests (Windows / Ubuntu)
if: matrix.test_type == ''
shell: bash
env:
MSYS2_ARG_CONV_EXCL: "*"
run: |
dotnet nuget add source "${{ github.workspace }}/artifacts" --name local-artifacts
dotnet nuget locals all --clear
dotnet restore src/typstsharp.tests/typstsharp.tests.csproj -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }}
dotnet test --project src/typstsharp.tests/typstsharp.tests.csproj -c Release -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }} --no-restore
- name: Run tests (Alpine musl)
if: matrix.test_type == 'docker-alpine'
shell: bash
run: |
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace mcr.microsoft.com/dotnet/sdk:10.0-alpine sh -c "
dotnet nuget add source /workspace/artifacts --name local-artifacts
dotnet nuget locals all --clear
dotnet restore src/typstsharp.tests/typstsharp.tests.csproj -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }}
dotnet test --project src/typstsharp.tests/typstsharp.tests.csproj -c Release -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }} --no-restore
"
- name: Run tests (Fedora)
if: matrix.test_type == 'docker-fedora'
shell: bash
run: |
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace fedora:40 sh -c "
dnf install -y curl tar icu
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 --install-dir /usr/share/dotnet
ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
dotnet nuget add source /workspace/artifacts --name local-artifacts
dotnet nuget locals all --clear
dotnet restore src/typstsharp.tests/typstsharp.tests.csproj -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }}
dotnet test --project src/typstsharp.tests/typstsharp.tests.csproj -c Release -p:UsePackagedLibrary=true -p:PackageVersion=${{ needs.pack.outputs.package_version }} --no-restore
"