-
Notifications
You must be signed in to change notification settings - Fork 11
80 lines (77 loc) · 2.49 KB
/
build.yml
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
name: build
on:
push: []
pull_request: []
jobs:
build_and_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- run: dotnet build
- run: dotnet test
- run: LANG=ar_SA.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- run: LANG=he_IL.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- run: LANG=fr_FR.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- name: benchmarks
run: |
export BENCODEX_BENCHMARKS_DATA_DIR="$(mktemp -d)"
tar xvfJ \
Bencodex.Benchmarks/bencodex-data.tar.xz \
-C "$BENCODEX_BENCHMARKS_DATA_DIR"
dotnet run -c Release -p Bencodex.Benchmarks
env:
BENCODEX_BENCHMARKS_SIMPLE: true
deploy:
needs: build_and_test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: bulid
run: |
timestamp="$(jq -r \
".head_commit.timestamp // .pull_request.head.repo.pushed_at" \
"$GITHUB_EVENT_PATH" \
)"
if [[ "$timestamp" = "null" || "$timestamp" = "" ]]; then
{
echo "Failed to get the head commit's timestamp:"
echo
cat "$GITHUB_EVENT_PATH"
} > /dev/stderr
exit 1
fi
timestamp=$(date --date="$timestamp" +%Y%m%d%H%M%S)
commit_hash="$(jq -r \
"(.head_commit.id // .pull_request.head.sha)[:8]" \
"$GITHUB_EVENT_PATH" \
)"
dotnet_args="-c Release -p:NoPackageAnalysis=true"
if [[ "$GITHUB_REF_TYPE" != tag ]]; then
project_suffix="dev.$timestamp+$commit_hash"
dotnet_args="$dotnet_args --version-suffix $project_suffix"
fi
dotnet build $dotnet_args
dotnet pack $dotnet_args
- name: push
if: github.event_name != 'pull_request'
run: |
if [[ "$NUGET_API_KEY" != "" ]]; then
dotnet nuget push ./Bencodex/bin/Release/Bencodex.*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json
dotnet nuget push ./Bencodex.Json/bin/Release/Bencodex.Json.*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json
fi
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}