From 114e665ee4fae0a611af12e60f057b60cdd94771 Mon Sep 17 00:00:00 2001 From: Yufei Huang Date: Mon, 6 Mar 2023 20:05:53 +0800 Subject: [PATCH] ci: snapshot test as standalone job --- .github/actions/build/action.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 27 +-------------------------- .github/workflows/snapshot-test.yml | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 .github/actions/build/action.yml create mode 100644 .github/workflows/snapshot-test.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 00000000000..995150479b7 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,28 @@ +name: build +description: build the project +runs: + using: "composite" + steps: + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.x + 7.x + - run: npm install + shell: bash + working-directory: templates + + - run: npm run lint + shell: bash + working-directory: templates + + - run: npm run build + shell: bash + working-directory: templates + + - run: dotnet build -c Release + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecd9fa05cbe..94c1e56a5c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,33 +14,8 @@ jobs: os: [windows-latest, macos-latest, ubuntu-latest] steps: - uses: actions/checkout@v3 - with: - lfs: true - - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 6.x - 7.x - - - run: npm install - working-directory: templates - - - run: npm run lint - working-directory: templates - - - run: npm run build - working-directory: templates - - - run: dotnet build -c Release - - - run: choco install wkhtmltopdf - if: matrix.os == 'windows-latest' - - run: dotnet test -c Release --filter Stage=Snapshot --no-build --collect:"XPlat Code Coverage" - working-directory: test/docfx.Snapshot.Tests + - uses: ./.github/actions/build - run: dotnet test -c Release -f net7.0 --filter Stage!=Snapshot --no-build --collect:"XPlat Code Coverage" diff --git a/.github/workflows/snapshot-test.yml b/.github/workflows/snapshot-test.yml new file mode 100644 index 00000000000..63fdf9fdd35 --- /dev/null +++ b/.github/workflows/snapshot-test.yml @@ -0,0 +1,21 @@ +name: ci +on: + pull_request: + branches: [ main, feature/*, hotfix/* ] + push: + branches: [ main, feature/*, hotfix/* ] + +jobs: + snapshot-test: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + lfs: true + + - uses: ./.github/actions/build + + - run: choco install wkhtmltopdf + + - run: dotnet test -c Release -f net7.0 --no-build + working-directory: test/docfx.Snapshot.Tests