5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:52:29 +08:00

chore: update-workflows (#2154)

* chore: merge test workflow

* chore: simplify sponsors image generation workflow

* chore: merge PR check workflow

* chore: merge push workflow

* chore: add auto sync translation document workflow

* chore: remove PR branch name check job

* chore: update go test job
This commit is contained in:
Misite Bao 2022-12-02 04:05:22 +08:00 committed by GitHub
parent 5cc012d763
commit c1c1b8b8e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 117 additions and 3708 deletions

View File

@ -2,18 +2,18 @@ name: Build + Test
on: on:
push: push:
branches: [ release/*, master ] branches: [release/*, master]
workflow_dispatch: workflow_dispatch:
jobs: jobs:
test: test_go:
name: Run Go Tests name: Run Go Tests
if: github.repository == 'wailsapp/wails' if: github.repository == 'wailsapp/wails'
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [ 1.18, 1.19 ] go-version: [1.18, 1.19]
steps: steps:
- name: Checkout code - name: Checkout code
@ -23,7 +23,7 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
- name: Set up Go 1.18 - name: Setup Go
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
@ -32,6 +32,31 @@ jobs:
working-directory: ./v2 working-directory: ./v2
run: go test -v ./... run: go test -v ./...
test_js:
name: Run JS Tests
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
working-directory: v2/internal/frontend/runtime
- name: Run tests
run: npm test
working-directory: v2/internal/frontend/runtime
test_templates: test_templates:
name: Test Templates name: Test Templates
needs: test needs: test
@ -39,9 +64,24 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ubuntu-latest, windows-latest, macos-latest]
template: [ svelte, svelte-ts, vue, vue-ts, react, react-ts, preact, preact-ts, lit, lit-ts, vanilla, vanilla-ts, plain ] template:
go-version: [ 1.18, 1.19 ] [
svelte,
svelte-ts,
vue,
vue-ts,
react,
react-ts,
preact,
preact-ts,
lit,
lit-ts,
vanilla,
vanilla-ts,
plain,
]
go-version: [1.18, 1.19]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@ -1,25 +0,0 @@
name: Check Docs
on:
pull_request:
branches: [ 'feature/*' ]
jobs:
docs:
name: Website Updated
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
- name: Run step only when files change.
if: steps.verify-changed-files.outputs.files_changed != 'true'
run: |
echo "Feature branch does not contain any changes to the website."

View File

@ -7,17 +7,18 @@ on:
jobs: jobs:
update-sponsors: update-sponsors:
name: Update Sponsors
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails' if: github.repository == 'wailsapp/wails'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set node - name: Set Node
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: 16.x node-version: 16.x
- name: Update sponsors - name: Update Sponsors
run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh
env: env:
SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }} SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}

View File

@ -1,30 +1,39 @@
name: PR Checks name: PR Checks
on: on:
pull_request: pull_request:
pull_request_review: pull_request_review:
types: [ submitted ] types: [submitted]
jobs: jobs:
check_branch_name: check_docs:
name: Check Docs
if: ${{github.repository == 'wailsapp/wails' && contains(github.head_ref,'feature/')}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
name: Check branch name
steps: steps:
- run: | - uses: actions/checkout@v3
if ! [[ "$(echo ${GITHUB_HEAD_REF} | cut -d "/" -f1)" =~ (feature|bugfix|release|chore) ]]; then
echo "PRs are only accepted for branches starting with: feature/, bugfix/, chore/ or release/"
exit 1
fi
shell: bash
test: - name: Verify Changed files
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
- name: Run step only when files change.
if: steps.verify-changed-files.outputs.files_changed != 'true'
run: |
echo "::warning::Feature branch does not contain any changes to the website."
test_go:
name: Run Go Tests name: Run Go Tests
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: github.event.review.state == 'approved' if: github.event.review.state == 'approved'
strategy: strategy:
matrix: matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ubuntu-latest, windows-latest, macos-latest]
go-version: [ 1.18, 1.19 ] go-version: [1.18, 1.19]
steps: steps:
- name: Checkout code - name: Checkout code
@ -34,10 +43,12 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
- name: Set up Go 1.18 - name: Setup Go
uses: actions/setup-go@v3 uses: actions/setup-go@v3
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Run tests - name: Run tests
run: go test -v ./... working-directory: ./v2
run: |
go test -v ./...

View File

@ -1,12 +1,11 @@
name: Push files to Crowdin name: Push
on: on:
push: push:
branches: [master] branches: [master]
workflow_dispatch:
jobs: jobs:
docs: push_files_to_crowdin:
name: Push files to Crowdin name: Push files to Crowdin
if: github.repository == 'wailsapp/wails' if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -0,0 +1,31 @@
name: Sync Translated Documents
on:
workflow_dispatch:
jobs:
sync-translated-documents:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
steps:
- uses: actions/checkout@v3
- name: Set node
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Sync Translated Documents
run: cd scripts && chmod 755 ./sync-translated-documents.sh && ./sync-translated-documents.sh
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "docs: sync documents"
title: "docs: sync documents"
body: "- [x] Sync translated documents"
branch: feature/documents
delete-branch: true
draft: true

View File

@ -1,32 +0,0 @@
name: Test JS
on:
push:
branches: [ release/*, master ]
workflow_dispatch:
jobs:
test:
name: Run JS Tests
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
working-directory: v2/internal/frontend/runtime
- name: Run tests
run: npm test
working-directory: v2/internal/frontend/runtime

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
npm install
npx sponsorkit -o ../../website/static/img/ npx sponsorkit@0.6.1 -o ../../website/static/img/

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
{
"name": "scripts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"sponsorkit": "^0.5.2"
}
}

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
cd ../website
npx @crowdin/cli@latest pull -b master