-
Notifications
You must be signed in to change notification settings - Fork 48
135 lines (128 loc) · 4.92 KB
/
main.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
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
name: main
on:
push:
branches:
- "**"
tags:
- "**"
pull_request:
branches:
- "**"
jobs:
build-and-test:
name: "build-and-test (${{ matrix.configuration }})"
strategy:
matrix:
configuration: ["Release"]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.400
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --self-contained=false --no-restore --configuration ${{ matrix.configuration }}
- name: Test
run: dotnet test --no-restore --verbosity normal --configuration ${{ matrix.configuration }}
build-for-unity:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.400
- name: Enforce net5.0 target with custom patch
run: |
set -e
sed -i -E 's|<TargetFramework>.*</TargetFramework>|<TargetFramework>net5.0</TargetFramework>|' Lib9c*/*.csproj
sed -i -E 's|<ImplicitUsings>.*</ImplicitUsings>|<ImplicitUsings>disable</ImplicitUsings>|' Lib9c*/*.csproj Libplanet*/*.csproj
sed -i -E 's|public bool TryGetValue\(TKey key, out TValue value, bool throwException\)|public bool TryGetValue\(TKey key, out TValue? value, bool throwException\)|' Lib9c/TableData/Sheet.cs
- name: build
run: dotnet build --self-contained=false
build-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.400
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: |
recursive: true
cwd: "integrations/javascript/@planetarium"
- name: Build Lib9c.Tools
run: dotnet build .Lib9c.Tools/Lib9c.Tools.csproj
- run: pnpm -r codegen
working-directory: "integrations/javascript/@planetarium"
- run: pnpm -r build
working-directory: "integrations/javascript/@planetarium"
- run: pnpm -r fmt:ci
working-directory: "integrations/javascript/@planetarium"
- run: pnpm -r test
working-directory: "integrations/javascript/@planetarium"
release:
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if a new tag refers a merge commit
if: github.ref_type == 'tag'
run: |
set -evx
curl -o /tmp/web-flow.gpg "$WEB_FLOW_KEY_URL"
gpg --import /tmp/web-flow.gpg
# shellcheck disable=SC2126
if ! git verify-commit "$GITHUB_REF_NAME" && \
[[ "$( git cat-file -p "$GITHUB_REF_NAME" \
| grep -Ei '^parent\s+[0-9a-f]{40}$' | wc -l )" -lt 2 ]]; then
echo "::error title=Invalid tag commit::Tags must refer to a merge" \
"commit or a commit signed by GitHub web-flow" \
"($WEB_FLOW_KEY_URL). The tag $GITHUB_REF_NAME refers to " \
"a commit $(git rev-parse "$GITHUB_REF_NAME") which is neither" \
"a merge commit nor signed by GitHub web-flow."
exit 1
fi
env:
WEB_FLOW_KEY_URL: https://github.com/web-flow.gpg
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.400
- name: Collect available action type ids
run: |
mkdir publish
dotnet run --property WarningLevel=0 --project .Lib9c.Tools/Lib9c.Tools.csproj -- action list > publish/all_action_type_ids.txt
dotnet run --property WarningLevel=0 --project .Lib9c.Tools/Lib9c.Tools.csproj -- action list --obsolete-only --json-path=publish/obsolete_action_types.json
- name: Publish available action type ids
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
destination_dir: ${{ github.ref_name }}
- name: Publish available action type ids for latest
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
destination_dir: latest
update-submodule:
if: github.ref_type == 'branch' && startsWith(github.ref_name, 'release/')
runs-on: ubuntu-latest
steps:
- name: Update other repos referring lib9c as submodules
uses: planetarium/submodule-updater@main
with:
token: ${{ secrets.SUBMODULE_UPDATER_GH_TOKEN }}
committer: >
Submodule Updater <[email protected]>
targets: |
planetarium/NineChronicles:refs/heads/release/*
${{ github.repository_owner }}/NineChronicles.Headless:refs/heads/release/*
${{ github.repository_owner }}/market-service:refs/heads/release/*