ci: check for change tag (#7149)

* ci: check for change tag

* fix workflow

* Update .scripts/ci/check-change-tags.js

* feat: also check if tag is known

seems like covector does not check that so we can do it here for now

* remove push run

* only check changed files

* add missing tag

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
This commit is contained in:
Amr Bashir 2023-06-07 16:32:36 +03:00 committed by GitHub
parent 1d99f8a3c2
commit fc2e4083b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 188 additions and 48 deletions

View File

@ -1,5 +1,5 @@
---
'@tauri-apps/api': 'patch'
'@tauri-apps/api': 'patch:feat'
---
Add `locale` function in the `os` module to get the system locale.

View File

@ -1,5 +1,5 @@
---
"tauri": "patch"
'tauri': 'patch:feat'
---
Add `tauri::api::os::locale` function to get the system locale.

View File

@ -1,5 +1,5 @@
---
"tauri-build": patch
'tauri-build': patch:enhance
---
Enhance Cargo features check.

View File

@ -1,5 +1,5 @@
---
"tauri-bundler": patch
'tauri-bundler': patch:enhance
---
Remove macOS app bundles from the output if they are not requested by the user.

View File

@ -1,6 +1,6 @@
---
'tauri-cli': minor
'@tauri-apps/cli': minor
'tauri-cli': minor:feat
'@tauri-apps/cli': minor:feat
---
Provide prebuilt CLIs for Windows ARM64 targets.

View File

@ -1,5 +1,5 @@
---
'tauri-utils': 'minor'
'tauri-utils': 'minor:feat'
---
Add option to configure `require_literal_leading_dot` on `fs` and `asset` protcol scopes.

View File

@ -1,6 +1,6 @@
---
'tauri': 'patch'
'tauri-runtime-wry': 'patch'
'tauri': 'patch:bug'
'tauri-runtime-wry': 'patch:bug'
---
Fix panics when registering an invalid global shortcuts or checking it is registered and return proper errors instead.

View File

@ -1,5 +1,5 @@
---
'tauri': 'patch'
'tauri': 'patch:bug'
---
Fix some configurations not applied when creating the window through Javascript.

View File

@ -1,5 +1,5 @@
---
"tauri": "patch"
'tauri': 'patch:bug'
---
Play a sound when showing a notification on Windows.

View File

@ -1,7 +1,7 @@
---
"tauri-utils": patch
"tauri-cli": patch
"@tauri-apps/cli": patch
'tauri-utils': patch:feat
'tauri-cli': patch:feat
'@tauri-apps/cli': patch:feat
---
Added the `desktop_template` option on `tauri.conf.json > tauri > bundle > deb`.

View File

@ -1,6 +1,6 @@
---
"tauri-cli": patch
"@tauri-apps/cli": patch
'tauri-cli': patch:enhance
'@tauri-apps/cli': patch:enhance
---
Enhance injection of Cargo features.

View File

@ -1,5 +1,5 @@
---
"tauri": patch
"tauri": 'minor:feat'
---
Expose the `test` module behind the `test` Cargo feature.

View File

@ -1,5 +1,5 @@
---
'tauri-utils': 'patch'
'tauri-utils': 'patch:feat'
---
Add `MimeType::parse_with_fallback` and `MimeType::parse_from_uri_with_fallback`

View File

@ -1,6 +1,6 @@
---
'tauri-bundler': 'minor:feat'
'tauri-utils': 'minor'
'tauri-utils': 'minor:feat'
'tauri-cli': 'minor:feat'
---

View File

@ -1,5 +1,5 @@
---
'tauri-utils': 'minor'
'tauri-utils': 'minor:feat'
'tauri-bundler': 'minor:feat'
'tauri-cli': 'minor:feat'
'@tauri-apps/cli': 'minor:feat'

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': 'patch'
'tauri-bundler': 'patch:bug'
---
Fix NSIS installer disabling `do not uninstall` button and silent installer aborting, if `allowDowngrades` was disabled even when we are not downgrading.

View File

@ -1,5 +1,5 @@
---
'tauri-utils': 'patch'
'tauri-utils': 'patch:feat'
---
Add `WindowsUpdateInstallMode::nsis_args`

View File

@ -1,5 +1,5 @@
---
'tauri': 'minor'
'tauri': 'minor:enhance'
---
Support `passive` mode for NSIS updater.

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': 'minor'
'tauri-bundler': 'minor:feat'
---
For NSIS, Add support for `/P` to install or uninstall in passive mode, `/R` to (re)start the app and `/NS` to disable creating shortcuts in `silent` and `passive` modes.

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': 'minor'
'tauri-bundler': 'minor:enhance'
---
NSIS `silent` and `passive` installer/updater will auto-kill the app if its running.

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': 'patch'
'tauri-bundler': 'patch:bug'
---
Fix NSIS silent installer not creating Desktop and StartMenu shortcuts. Pass `/NS` to disable creating them.

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': 'minor'
'tauri-bundler': 'minor:enhance'
---
NSIS installer will now check if a previous WiX `.msi` installation exist and will prompt users to uninstall it.

View File

@ -1,5 +1,5 @@
---
'tauri-bundler': patch
'tauri-bundler': patch:enhance
---
Remove `attohttpc` in favor of `ureq`.

View File

@ -1,5 +1,5 @@
---
'tauri': patch
'tauri': patch:enhance
---
Remove `attohttpc` in favor of `reqwest`.

View File

@ -1,6 +1,6 @@
---
'tauri-cli': patch
'@tauri-apps/cli': patch
'tauri-cli': patch:enhance
'@tauri-apps/cli': patch:enhance
---
Add `rustls` as default Cargo feature.

View File

@ -1,5 +1,5 @@
---
"tauri-utils": patch
'tauri-utils': patch:feat
---
Correctly determine MIME type of `.txt` files.

32
.github/workflows/check-change-tags.yml vendored Normal file
View File

@ -0,0 +1,32 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check change tags
on:
pull_request:
paths:
- '.changes/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
changes:
- '.changes/*.md'
- name: check
run: node ./.scripts/ci/check-change-tags.js ${{ steps.filter.outputs.changes_files }}
if: ${{ steps.filter.outputs.changes == 'true' }}

View File

@ -13,16 +13,6 @@ on:
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
push:
branches:
- dev
paths:
- '.github/workflows/check-generated-files.yml'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

View File

@ -25,4 +25,4 @@ jobs:
- added: '**'
- name: check header license on new files
if: ${{ steps.filter.outputs.added == 'true' }}
run: node check-license-header.js ${{ steps.filter.outputs.added_files }}
run: node ./.scripts/ci/check-license-header.js ${{ steps.filter.outputs.added_files }}

View File

@ -1,4 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@ -0,0 +1,79 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const fs = require('fs')
const path = require('path')
const ignorePackages = [
'tauri-macros',
'tauri-codegen',
'tauri-runtime',
'tauri-runtime-wry',
'tauri-driver'
]
const covectorConfig = JSON.parse(
fs.readFileSync('.changes/config.json', 'utf8')
)
const tags = Object.keys(covectorConfig.changeTags)
const missingTagsFiles = {}
const unknownTagsFiles = {}
function checkChangeFiles(changeFiles) {
for (const file of changeFiles) {
const content = fs.readFileSync(file, 'utf8')
const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content)
const packages = frontMatter
.split('\n')
.filter((l) => !(l === '---' || !l))
.map((l) => l.replace(/('|")/g, '').split(':'))
for (const [package, _, tag] of packages) {
if (!tag) {
if (ignorePackages.includes(package)) continue
if (!missingTagsFiles[file]) missingTagsFiles[file] = []
missingTagsFiles[file].push(package)
} else if (!tags.includes(tag)) {
if (!unknownTagsFiles[file]) unknownTagsFiles[file] = []
unknownTagsFiles[file].push({ package, tag })
}
}
}
const missingTagsEntries = Object.entries(missingTagsFiles)
const unknownTagsEntries = Object.entries(unknownTagsFiles)
if (missingTagsEntries.length > 0 || unknownTagsEntries.length > 0) {
for (const [file, packages] of missingTagsEntries) {
for (const package of packages) {
console.error(
`Package \`${package}\` is missing a change tag in ${file} `
)
}
}
for (const [file, packages] of unknownTagsEntries) {
for (const { package, tag } of packages) {
console.error(
`Package \`${package}\` has an uknown change tag ${tag} in ${file} `
)
}
}
process.exit(1)
}
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
checkChangeFiles(files.filter((f) => f.toLowerCase() !== 'readme.md'))
} else {
const changeFiles = fs
.readdirSync('.changes')
.filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md')
.map((p) => path.join('.changes', p))
checkChangeFiles(changeFiles)
}

View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@ -9,13 +11,22 @@ const readline = require('readline')
const header = `Copyright 2019-2023 Tauri Programme within The Commons Conservancy
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: MIT`
const bundlerLicense = '// Copyright 2016-2019 Cargo-Bundle developers <https://github.com/burtonageo/cargo-bundle>'
const bundlerLicense =
'// Copyright 2016-2019 Cargo-Bundle developers <https://github.com/burtonageo/cargo-bundle>'
const extensions = ['.rs', '.js', '.ts', '.yml']
const ignore = ['target', 'templates', 'node_modules', 'gen', 'dist', 'bundle.js', 'bundle.global.js']
const ignore = [
'target',
'templates',
'node_modules',
'gen',
'dist',
'bundle.js',
'bundle.global.js'
]
async function checkFile(file) {
if (extensions.some(e => file.endsWith(e))) {
if (extensions.some((e) => file.endsWith(e))) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
@ -26,7 +37,11 @@ async function checkFile(file) {
let i = 0
for await (let line of rl) {
// ignore empty lines, allow shebang and bundler license
if (line.length === 0 || line.startsWith("#!") || line === bundlerLicense) {
if (
line.length === 0 ||
line.startsWith('#!') ||
line === bundlerLicense
) {
continue
}
@ -93,7 +108,7 @@ if (files.length > 0) {
run()
} else {
check('.').then(missing => {
check('.').then((missing) => {
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)

View File

@ -1,5 +1,9 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
if git diff --quiet --ignore-submodules HEAD
then
echo "working directory is clean"

View File

@ -1,4 +1,9 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
set -euxo pipefail
for o in outputs/*; do

View File

@ -1,4 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,4 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@ -1,3 +1,7 @@
#!/bin/sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
docker build -t aarch64-unknown-linux-gnu:latest --file .docker/cross/aarch64.Dockerfile .docker/cross

View File

@ -1,4 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@ -1,3 +1,7 @@
: Copyright 2019-2023 Tauri Programme within The Commons Conservancy
: SPDX-License-Identifier: Apache-2.0
: SPDX-License-Identifier: MIT
@ECHO OFF
REM Copyright 2019-2023 Tauri Programme within The Commons Conservancy