mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 03:29:03 +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
|
||||
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:
|
||||
name: Run Go Tests
|
||||
needs: check_approval
|
||||
@ -56,24 +100,24 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Examples
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: task test:examples
|
||||
|
||||
- name: Run tests (mac)
|
||||
if: matrix.os == 'macos-latest'
|
||||
env:
|
||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (ubuntu)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: >
|
||||
xvfb-run --auto-servernum
|
||||
sh -c '
|
||||
@ -82,7 +126,7 @@ jobs:
|
||||
'
|
||||
|
||||
- name: Typecheck binding generator output
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: task generator:test:check
|
||||
|
||||
test_js:
|
||||
@ -108,23 +152,27 @@ jobs:
|
||||
version: 3.x
|
||||
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
|
||||
working-directory: ./v3
|
||||
|
||||
- name: Test runtime
|
||||
working-directory: v3
|
||||
run: task runtime:test
|
||||
working-directory: ./v3
|
||||
|
||||
- name: Build bundled runtime
|
||||
- name: Check that the bundled runtime builds
|
||||
working-directory: v3
|
||||
run: |
|
||||
npx --yes -p esbuild@latest exit
|
||||
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
|
||||
working-directory: ./v3/internal/runtime/desktop/@wailsio/runtime
|
||||
|
||||
test_templates:
|
||||
name: Test Templates
|
||||
@ -172,7 +220,7 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Wails3 CLI
|
||||
working-directory: ./v3
|
||||
working-directory: v3
|
||||
run: |
|
||||
task install
|
||||
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'
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config --local user.email "github-actions@github.com"
|
||||
@ -29,62 +28,65 @@ jobs:
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Test+Build
|
||||
run: |
|
||||
npm ci
|
||||
npm test
|
||||
npm run build
|
||||
- name: Clean build artifacts
|
||||
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||
run: npm run clean
|
||||
|
||||
- name: Build bundled runtime
|
||||
working-directory: v3
|
||||
run: |
|
||||
npx --yes -p esbuild@latest exit
|
||||
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
|
||||
id: build-artifact-changes
|
||||
id: package-changes
|
||||
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
|
||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
||||
run: |
|
||||
npm version prerelease
|
||||
if: steps.package-changes.outputs.files_changed == 'true'
|
||||
id: bump-version
|
||||
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
|
||||
|
||||
- name: Get version
|
||||
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
|
||||
run: |
|
||||
echo "version=$(npm version prerelease)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit changes
|
||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
||||
if: steps.package-changes.outputs.files_changed == 'true'
|
||||
run: |
|
||||
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
|
||||
|
||||
- uses: JS-DevTools/npm-publish@v3
|
||||
if: steps.build-artifact-changes.outputs.files_changed == 'true'
|
||||
- name: Publish npm package
|
||||
uses: JS-DevTools/npm-publish@v3
|
||||
if: steps.package-changes.outputs.files_changed == 'true'
|
||||
with:
|
||||
package: v3/internal/runtime/desktop/@wailsio/runtime
|
||||
access: public
|
||||
token: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Detect bundled runtime changes
|
||||
if: steps.build-artifact-changes.outputs.files_changed != 'true'
|
||||
- name: Detect docs and bundled runtime changes
|
||||
if: steps.package-changes.outputs.files_changed != 'true'
|
||||
uses: tj-actions/verify-changed-files@v20
|
||||
id: bundle-changes
|
||||
id: docs-bundle-changes
|
||||
with:
|
||||
files: v3/internal/assetserver/bundledassets/**
|
||||
files: |
|
||||
v3/internal/assetserver/bundledassets/**
|
||||
v3/internal/runtime/desktop/@wailsio/runtime/docs/**
|
||||
|
||||
- name: Commit bundled runtime changes
|
||||
if: steps.build-artifact-changes.outputs.files_changed != 'true' && steps.bundle-changes.outputs.files_changed == 'true'
|
||||
- name: Commit docs and bundled runtime changes
|
||||
if: steps.package-changes.outputs.files_changed != 'true' && steps.docs-bundle-changes.outputs.files_changed == 'true'
|
||||
run: |
|
||||
git add .
|
||||
git commit -m "[skip ci] Update bundled runtime"
|
||||
git commit -m "[skip ci] Update runtime docs and bundle"
|
||||
git push
|
||||
|
Loading…
Reference in New Issue
Block a user