mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 06:09:56 +08:00
Restructure workflows
This commit is contained in:
parent
b59f003f61
commit
c0f92d69a0
74
.github/workflows/build-and-test-v3.yml
vendored
74
.github/workflows/build-and-test-v3.yml
vendored
@ -22,6 +22,50 @@ jobs:
|
|||||||
echo "approved=false" >> $GITHUB_OUTPUT
|
echo "approved=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check_build_artifacts:
|
||||||
|
name: Check runtime build artifact changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: 'true'
|
||||||
|
|
||||||
|
- name: Get changed files
|
||||||
|
id: changed-files
|
||||||
|
uses: tj-actions/changed-files@v45
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
v3/internal/runtime/desktop/@wailsio/runtime/dist/**
|
||||||
|
v3/internal/runtime/desktop/@wailsio/runtime/types/**
|
||||||
|
|
||||||
|
- name: Get merge base
|
||||||
|
id: merge-base
|
||||||
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
|
env:
|
||||||
|
BASE_SHA: ${{github.event.pull_request.base.sha}}
|
||||||
|
HEAD_SHA: ${{github.event.pull_request.head.sha}}
|
||||||
|
run: |
|
||||||
|
echo "sha=$(git merge-base "$BASE_SHA" "$HEAD_SHA")" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: This PR includes changes to runtime build artifacts
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
if: steps.changed-files.outputs.any_changed == 'true'
|
||||||
|
env:
|
||||||
|
MERGE_BASE_SHA: ${{steps.merge-base.outputs.sha}}
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
process.exitCode = 1
|
||||||
|
core.error(
|
||||||
|
'The CI pipeline will rebuild and publish the runtime automatically.\n' +
|
||||||
|
'Please run the following command (or equivalent) in your local wails repo\n' +
|
||||||
|
'to revert all build artifact changes; then update the PR:\n\n' +
|
||||||
|
' cd v3/internal/runtime/desktop/@wailsio/runtime &&\n' +
|
||||||
|
` git restore -s ${process.env.MERGE_BASE_SHA} -W -S -- dist types &&${"\n"}` +
|
||||||
|
' git commit -m "Revert build artifact changes"\n',
|
||||||
|
{ title: 'This PR includes changes to runtime build artifacts' }
|
||||||
|
);
|
||||||
|
|
||||||
test_go:
|
test_go:
|
||||||
name: Run Go Tests
|
name: Run Go Tests
|
||||||
needs: check_approval
|
needs: check_approval
|
||||||
@ -56,24 +100,24 @@ jobs:
|
|||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build Examples
|
- name: Build Examples
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: task test:examples
|
run: task test:examples
|
||||||
|
|
||||||
- name: Run tests (mac)
|
- name: Run tests (mac)
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
env:
|
env:
|
||||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
||||||
- name: Run tests (windows)
|
- name: Run tests (windows)
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
||||||
- name: Run tests (ubuntu)
|
- name: Run tests (ubuntu)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: >
|
run: >
|
||||||
xvfb-run --auto-servernum
|
xvfb-run --auto-servernum
|
||||||
sh -c '
|
sh -c '
|
||||||
@ -82,7 +126,7 @@ jobs:
|
|||||||
'
|
'
|
||||||
|
|
||||||
- name: Typecheck binding generator output
|
- name: Typecheck binding generator output
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: task generator:test:check
|
run: task generator:test:check
|
||||||
|
|
||||||
test_js:
|
test_js:
|
||||||
@ -108,23 +152,27 @@ jobs:
|
|||||||
version: 3.x
|
version: 3.x
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Typecheck runtime
|
- name: Clean build artifacts
|
||||||
|
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
|
run: npm run clean
|
||||||
|
|
||||||
|
- name: Type-check runtime
|
||||||
|
working-directory: v3
|
||||||
run: task runtime:check
|
run: task runtime:check
|
||||||
working-directory: ./v3
|
|
||||||
|
|
||||||
- name: Test runtime
|
- name: Test runtime
|
||||||
|
working-directory: v3
|
||||||
run: task runtime:test
|
run: task runtime:test
|
||||||
working-directory: ./v3
|
|
||||||
|
|
||||||
- name: Build bundled runtime
|
- name: Check that the bundled runtime builds
|
||||||
|
working-directory: v3
|
||||||
run: |
|
run: |
|
||||||
npx --yes -p esbuild@latest exit
|
npx --yes -p esbuild@latest exit
|
||||||
task runtime:build
|
task runtime:build
|
||||||
working-directory: ./v3
|
|
||||||
|
|
||||||
- name: Verify that the npm package builds correctly
|
- name: Check that the npm package builds
|
||||||
|
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
run: npm run prepack
|
run: npm run prepack
|
||||||
working-directory: ./v3/internal/runtime/desktop/@wailsio/runtime
|
|
||||||
|
|
||||||
test_templates:
|
test_templates:
|
||||||
name: Test Templates
|
name: Test Templates
|
||||||
@ -172,7 +220,7 @@ jobs:
|
|||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build Wails3 CLI
|
- name: Build Wails3 CLI
|
||||||
working-directory: ./v3
|
working-directory: v3
|
||||||
run: |
|
run: |
|
||||||
task install
|
task install
|
||||||
wails3 doctor
|
wails3 doctor
|
||||||
|
48
.github/workflows/pr-v3.yml
vendored
48
.github/workflows/pr-v3.yml
vendored
@ -1,48 +0,0 @@
|
|||||||
name: PR Checks v3
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changed_files:
|
|
||||||
name: Prevent runtime build artifact changes
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
persist-credentials: 'true'
|
|
||||||
|
|
||||||
- name: Get changed files
|
|
||||||
id: changed-files
|
|
||||||
uses: tj-actions/changed-files@v45
|
|
||||||
with:
|
|
||||||
files: v3/internal/runtime/desktop/@wailsio/runtime/{dist,docs,types}/**
|
|
||||||
|
|
||||||
- name: Get merge base
|
|
||||||
id: merge-base
|
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
|
||||||
env:
|
|
||||||
BASE_SHA: ${{github.event.pull_request.base.sha}}
|
|
||||||
HEAD_SHA: ${{github.event.pull_request.head.sha}}
|
|
||||||
run: |
|
|
||||||
echo "MERGE_BASE_SHA=$(git merge-base "$BASE_SHA" "$HEAD_SHA")" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Fail and report
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
if: steps.changed-files.outputs.any_changed == 'true'
|
|
||||||
env:
|
|
||||||
MERGE_BASE_SHA: ${{steps.merge-base.outputs.MERGE_BASE_SHA}}
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
process.exitCode = 1
|
|
||||||
core.error(
|
|
||||||
'The CI pipeline will rebuild and publish the runtime automatically.\n' +
|
|
||||||
'Please run the following command (or equivalent) in your local wails repo\n' +
|
|
||||||
'to revert all build artifact changes, then update the PR:\n\n' +
|
|
||||||
' cd v3/internal/runtime/desktop/@wailsio/runtime &&\n' +
|
|
||||||
` git restore -s ${process.env.MERGE_BASE_SHA} -W -S -- dist docs types &&${"\n"}` +
|
|
||||||
' git commit -m "Revert build artifact changes"',
|
|
||||||
{ title: "Build artifact changes detected" }
|
|
||||||
);
|
|
64
.github/workflows/publish-npm.yml
vendored
64
.github/workflows/publish-npm.yml
vendored
@ -12,7 +12,6 @@ jobs:
|
|||||||
ref: 'v3-alpha'
|
ref: 'v3-alpha'
|
||||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
|
||||||
|
|
||||||
- name: Configure git
|
- name: Configure git
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "github-actions@github.com"
|
git config --local user.email "github-actions@github.com"
|
||||||
@ -29,62 +28,65 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
|
|
||||||
- name: Test+Build
|
- name: Clean build artifacts
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm test
|
|
||||||
npm run build
|
|
||||||
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
|
run: npm run clean
|
||||||
|
|
||||||
- name: Build bundled runtime
|
- name: Build bundled runtime
|
||||||
|
working-directory: v3
|
||||||
run: |
|
run: |
|
||||||
npx --yes -p esbuild@latest exit
|
npx --yes -p esbuild@latest exit
|
||||||
task runtime:build
|
task runtime:build
|
||||||
working-directory: v3
|
|
||||||
|
|
||||||
- name: Detect build artifact changes
|
- name: Test+Build npm package
|
||||||
|
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm test
|
||||||
|
npm run prepack
|
||||||
|
|
||||||
|
- name: Detect npm package changes
|
||||||
uses: tj-actions/verify-changed-files@v20
|
uses: tj-actions/verify-changed-files@v20
|
||||||
id: build-artifact-changes
|
id: package-changes
|
||||||
with:
|
with:
|
||||||
files: v3/internal/runtime/desktop/@wailsio/runtime/{dist,types,docs}/**
|
files: |
|
||||||
|
v3/internal/runtime/desktop/@wailsio/runtime/dist/**
|
||||||
|
v3/internal/runtime/desktop/@wailsio/runtime/types/**
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
if: steps.package-changes.outputs.files_changed == 'true'
|
||||||
run: |
|
id: bump-version
|
||||||
npm version prerelease
|
|
||||||
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
|
run: |
|
||||||
- name: Get version
|
echo "version=$(npm version prerelease)" >> $GITHUB_OUTPUT
|
||||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
|
||||||
id: get-version
|
|
||||||
uses: beaconbrigade/package-json-version@v0.3.2
|
|
||||||
with:
|
|
||||||
path: v3/internal/runtime/desktop/@wailsio/runtime
|
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
if: steps.package-changes.outputs.files_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.get-version.outputs.version }}"
|
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.bump-version.outputs.version }}"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
- uses: JS-DevTools/npm-publish@v3
|
- name: Publish npm package
|
||||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
uses: JS-DevTools/npm-publish@v3
|
||||||
|
if: steps.package-changes.outputs.files_changed == 'true'
|
||||||
with:
|
with:
|
||||||
package: v3/internal/runtime/desktop/@wailsio/runtime
|
package: v3/internal/runtime/desktop/@wailsio/runtime
|
||||||
access: public
|
access: public
|
||||||
token: ${{ secrets.NPM_TOKEN }}
|
token: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
- name: Detect bundled runtime changes
|
- name: Detect docs and bundled runtime changes
|
||||||
if: steps.build-artifact-changes.outputs.files_changed != 'true'
|
if: steps.package-changes.outputs.files_changed != 'true'
|
||||||
uses: tj-actions/verify-changed-files@v20
|
uses: tj-actions/verify-changed-files@v20
|
||||||
id: bundle-changes
|
id: docs-bundle-changes
|
||||||
with:
|
with:
|
||||||
files: v3/internal/assetserver/bundledassets/**
|
files: |
|
||||||
|
v3/internal/assetserver/bundledassets/**
|
||||||
|
v3/internal/runtime/desktop/@wailsio/runtime/docs/**
|
||||||
|
|
||||||
- name: Commit bundled runtime changes
|
- name: Commit docs and bundled runtime changes
|
||||||
if: steps.build-artifact-changes.outputs.files_changed != 'true' && steps.bundle-changes.outputs.files_changed == 'true'
|
if: steps.package-changes.outputs.files_changed != 'true' && steps.docs-bundle-changes.outputs.files_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
git commit -m "[skip ci] Update bundled runtime"
|
git commit -m "[skip ci] Update runtime docs and bundle"
|
||||||
git push
|
git push
|
||||||
|
Loading…
Reference in New Issue
Block a user