Merge pull request #3062 from planetarium/feature/growth12 #13995
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 build | |
working-directory: "integrations/javascript/@planetarium/lib9c" | |
- run: pnpm -r fmt:ci | |
working-directory: "integrations/javascript/@planetarium/lib9c" | |
- run: pnpm -r test | |
working-directory: "integrations/javascript/@planetarium/lib9c" | |
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/* |