chore: GitHub action's rewrite

This commit is contained in:
LynithDev 2024-10-18 19:28:08 +02:00
parent a39007bfb3
commit f6c997e292
11 changed files with 43 additions and 899 deletions

View file

@ -1,46 +0,0 @@
name: Run Clippy
description: Run Clippy
inputs:
github_token:
description: GitHub token
required: false
default: ${{ github.token }}
clippy_flags:
description: clippy flags
required: false
default: ''
tool_name:
description: tool name to use for reviewdog reporter
required: false
default: Clippy
level:
description: 'report level for reviewdog [info,warning,error]'
required: false
default: error
reporter:
description: 'reporter of reviewdog command [github-pr-check,github-pr-review,github-check].'
required: false
default: github-pr-check
filter_mode:
description: filtering for the reviewdog command [added,diff_context,file,nofilter].
required: false
default: added
fail_on_error:
description: exit code for reviewdog when errors are found [true,false]
required: false
default: 'false'
reviewdog_flags:
description: additional reviewdog flags
required: false
default: ''
workdir:
description: working directory relative to the root directory
required: false
default: .
reviewdog_version:
description: the version of reviewdog
required: false
default: latest
runs:
using: node20
main: dist/index.js

View file

@ -1,223 +0,0 @@
@actions/core
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/exec
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/http-client
MIT
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/io
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@actions/tool-cache
MIT
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@fastify/busboy
MIT
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
pathe
MIT
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------------------------------
Copyright Joyent, Inc. and other Node contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
semver
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
tunnel
MIT
The MIT License (MIT)
Copyright (c) 2012 Koichi Kobayashi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
undici
MIT
MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
uuid
MIT
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because one or more lines are too long

View file

@ -1,30 +0,0 @@
{
"name": "@onelauncher/action-clippy",
"version": "1.0.0-alpha.1",
"private": true,
"description": "Next-generation open source Minecraft launcher",
"license": "GPL-3.0-only",
"repository": {
"type": "git",
"url": "git@github.com:polyfrost/onelauncher",
"directory": ".github/actions/clippy"
},
"bugs": "https://github.com/polyfrost/onelauncher/issues",
"sideEffects": false,
"scripts": {
"build": "rimraf dist && ncc build src/index.ts -m -q --license ../../LICENSE"
},
"dependencies": {
"@actions/artifact": "^2.1.9",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/glob": "^0.5.0",
"@actions/http-client": "^2.2.3",
"@actions/io": "^1.1.3",
"@actions/tool-cache": "^2.0.1",
"pathe": "^1.1.2"
},
"devDependencies": {
"@vercel/ncc": "^0.38.2"
}
}

View file

@ -1,129 +0,0 @@
import { Buffer } from 'node:buffer';
import { promises as fs } from 'node:fs';
import { tmpdir as getTmpdir } from 'node:os';
import { env, cwd as getCwd } from 'node:process';
import { getInput as getCoreInput, group } from '@actions/core';
import { exec } from '@actions/exec';
import { rmRF } from '@actions/io';
import { join, relative } from 'pathe';
import { installReviewdog } from './installer';
const getInput = <T = string>(name: string): T => getCoreInput(name) as T;
async function run(): Promise<void> {
const runnerTmpdir = env.RUNNER_TEMP || getTmpdir();
const tmpdir = await fs.mkdtemp(join(runnerTmpdir, 'reviewdog-'));
const reviewdogVersion = getInput('reviewdog_version') || 'latest';
const toolName = getInput('tool_name') || 'clippy';
const clippyFlags = getInput('clippy_flags');
const clippyDebug = getInput('clippy_debug') || 'false';
const level = getInput('level') || 'error';
const reporter = getInput('reporter') || 'github-pr-check';
const filterMode = getInput('filter_mode') || 'added';
const failOnError = getInput('fail_on_error') || 'false';
const reviewdogFlags = getInput('reviewdog_flags');
const workdir = getInput('workdir') || '.';
const cwd = relative(env.GITHUB_WORKSPACE || getCwd(), workdir);
const reviewdog = await group('installing reviewdog', async () => await installReviewdog(reviewdogVersion, tmpdir));
const output: string[] = [];
await exec(
'cargo',
[
'+nightly',
'clippy',
'--color',
'never',
'-q',
'--message-format',
'json',
...parse(clippyFlags),
],
{
cwd,
ignoreReturnCode: true,
silent: clippyDebug !== 'true',
listeners: {
stdline: (data) => {
const content: CompilerMessage = JSON.parse(data);
if (content.reason !== 'compiler-message')
return;
if (content.message.code === null)
return;
const span = content.message.spans[0]!;
const messageLevel = content.message.level === 'warning' ? 'w' : 'e';
const rendered = reporter === 'github-pr-review'
? ` \n<pre><code>${content.message.rendered}</code></pre>\n__END__`
: `${content.message.rendered}\n__END__`;
const ret = `${span.file_name}:${span.line_start}:${span.column_start}:${messageLevel}:${rendered}`;
output.push(ret);
},
},
},
);
env.REVIEWDOG_GITHUB_API_TOKEN = getInput('github_token');
await exec(
reviewdog,
[
'-efm=<pre><code>%E%f:%l:%c:%t:%m',
'-efm=%E%f:%l:%c:%t:%m',
'-efm=%Z__END__',
'-efm=%C%m</code></pre>',
'-efm=%C%m',
'-efm=%C',
`-name=${toolName}`,
`-reporter=${reporter}`,
`-filter-mode=${filterMode}`,
`-fail-on-error=${failOnError}`,
`-level=${level}`,
...parse(reviewdogFlags),
],
{
cwd,
input: Buffer.from(output.join('\n'), 'utf-8'),
ignoreReturnCode: true,
},
);
await rmRF(tmpdir);
}
function parse(flags: string): string[] {
flags = flags.trim();
if (flags === '')
return [];
return flags.split(/\s+/);
}
interface CompilerMessage {
reason: string;
message: {
code: Code;
level: string;
message: string;
rendered: string;
spans: Span[];
};
}
interface Code {
code: string;
explanation?: string;
}
interface Span {
file_name: string;
is_primary: boolean;
line_start: number;
line_end: number;
column_start: number;
column_end: number;
}
run();

View file

@ -1,43 +0,0 @@
import { arch as getArch, platform as getPlatform } from 'node:process';
import { Headers, HttpClient, HttpCodes } from '@actions/http-client';
import { downloadTool, extractTar } from '@actions/tool-cache';
import { join } from 'pathe';
const getUrl = (version: string, platform: string, arch: string) => `https://github.com/reviewdog/reviewdog/releases/download/v${version}/reviewdog_${version}_${platform}_${arch}.tar.gz`;
interface Release {
tag_name: string;
}
export async function installReviewdog(tag: string, directory: string): Promise<string> {
const version = await tagToVersion(tag, 'reviewdog', 'reviewdog');
const platform = getPlatform === 'darwin' ? 'Darwin' : getPlatform === 'linux' ? 'Linux' : getPlatform === 'win32' ? 'Windows' : '';
const arch = getArch === 'x64' ? 'x86_64' : getArch === 'arm64' ? getArch : '';
if (platform === '')
throw new Error(`unsupported platform ${getPlatform}!`);
if (arch === '')
throw new Error(`unsupported architecture: ${getArch}!`);
const url = getUrl(version, platform, arch);
const archivePath = await downloadTool(url);
const extractedDir = await extractTar(archivePath, directory);
const executablePath = `reviewdog${getPlatform === 'win32' ? '.exe' : ''}`;
return join(extractedDir, executablePath);
}
async function tagToVersion(tag: string, owner: string, repo: string): Promise<string> {
const url = `https://github.com/${owner}/${repo}/releases/${tag}`;
const client = new HttpClient('clippy/v1');
const headers = { [Headers.Accept]: 'application/json' };
const response = await client.getJson<Release>(url, headers);
if (response.statusCode !== HttpCodes.OK)
throw new Error(`${url} returned unexpected HTTP status code: ${response.statusCode}`);
if (!response.result)
throw new Error(`unable to find '${tag}' - use 'latest' or see https://github.com/${owner}/${repo}/releases for details`);
return response.result.tag_name.replace(/^v/, '');
}

View file

@ -1,9 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"allowImportingTsExtensions": false,
"noEmit": true,
"skipLibCheck": true
},
"exclude": ["**/dist/**"]
}

View file

@ -1,181 +0,0 @@
name: Build
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
merge_group:
workflow_dispatch:
env:
ONELAUNCHER_CUSTOM_APT_FLAGS: --no-install-recommends
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
es:
name: EcmaScript Checks
runs-on: ubuntu-22.04
timeout-minutes: 7
permissions: {}
steps:
- name: Prepare Target
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1))" >> "${GITHUB_ENV}"
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Setup Pnpm
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Linting
run: pnpm lint:es
# - name: Testing
# run: pnpm test:es
rust:
name: Rustfmt
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
steps:
- name: (Linux) Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
with:
swap-size-mb: 4096
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: (Windows) Setup Target
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
- name: Prepare Target
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
continue-on-error: true
id: filter
with:
filters: |
changes:
- ${{ runner.os == 'Windows' && 'packages/scripts/setup.ps1' || 'packages/scripts/setup.sh' }}
- 'packages/scripts/prepare.ts'
- 'apps/cli/**'
- 'apps/desktop/**'
- 'apps/testing/**'
- 'packages/core/**'
- 'packages/macros/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/build.yml'
- '.github/actions/setup-rust/**'
- '.github/actions/setup-system/**'
- name: Setup Rust
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
uses: ./.github/actions/setup-rust
with:
restore-cache: false
- name: Run Rustfmt
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
run: cargo +nightly fmt --all -- --check
clippy:
strategy:
fail-fast: true
matrix:
settings:
- host: macos-13
target: x86_64-apple-darwin
- host: macos-14
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
runs-on: ${{ matrix.settings.host }}
name: Clippy (${{ matrix.settings.host }})
timeout-minutes: 45
permissions:
contents: read
steps:
- name: (Linux) Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
with:
swap-size-mb: 4096
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: (Windows) Setup Target
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
- name: Prepare Target
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
continue-on-error: true
id: preparation
with:
filters: |
changes:
- ${{ runner.os == 'Windows' && 'packages/scripts/setup.ps1' || 'packages/scripts/setup.sh' }}
- 'packages/scripts/prepare.ts'
- 'apps/cli/**'
- 'apps/desktop/**'
- 'apps/testing/**'
- 'packages/core/**'
- 'packages/macros/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/build.yml'
- '.github/actions/setup-rust/**'
- '.github/actions/setup-system/**'
- name: Setup System
if: steps.preparation.outcome != 'success' || steps.preparation.outputs.changes == 'true'
uses: ./.github/actions/setup-system
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Clippy
if: steps.preparation.outcome != 'success' || steps.preparation.outputs.changes == 'true'
uses: ./.github/actions/clippy
with:
reporter: github-pr-review
tool_name: 'Clippy (${{ matrix.settings.host }})'
filter_mode: diff_context
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --workspace --all-features --locked
fail_on_error: true

View file

@ -1,135 +0,0 @@
name: Build Artifacts
on:
pull_request:
paths:
- .github/workflows/release.yml
- .github/actions/publish-artifacts/**
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
desktop:
strategy:
matrix:
settings:
- host: macos-13
target: x86_64-apple-darwin
bundles: dmg,app
os: darwin
arch: x86_64
- host: macos-14
target: aarch64-apple-darwin
bundles: dmg,app
os: darwin
arch: aarch64
- host: windows-latest
target: x86_64-pc-windows-msvc
bundles: msi
os: windows
arch: x86_64
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bundles: deb
os: linux
arch: x86_64
binary: onelauncher_gui
name: Desktop (${{ matrix.settings.target }})
runs-on: ${{ matrix.settings.host }}
continue-on-error: true
steps:
- name: (Linux) Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
with:
swap-size-mb: 4096
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: (Windows) Setup Target
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
# - name: (macOS) - Download Apple key
# i f: ${ { runner.os == 'macOS' }}
# run: |
# mkdir -p ~/.appstoreconnect/private_keys/
# cd ~/.appstoreconnect/private_keys/
# echo ${ { secrets.APPLE_API_KEY_B64 }} >> AuthKey_${ { secrets.APPLE_API_KEY }}.p8.base64
# base64 --decode -i AuthKey_$ {{ secrets.APPLE_API_KEY }}.p8.base64 -o AuthKey_${ { secrets.APPLE_API_KEY }}.p8
# rm AuthKey_${ { secrets.APPLE_API_KEY }}.p8.base64
# - name: (macOS) - Install Apple key
# i f: ${ { runner.os == 'macOS' }}
# uses: apple-actions/import-codesign-certs@v2
# with:
# p12-file-base64: ${ { secrets.APPLE_CERTIFICATE }}
# p12-password: ${ { secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Setup System
uses: ./.github/actions/setup-system
# env:
# APPLE_SIGNING_IDENTITY: ${ { secrets.APPLE_SIGNING_IDENTITY }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.settings.target }}
- name: Setup Pnpm
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}
# env:
# TAURI_SIGNING_PRIVATE_KEY: $ {{ secrets.TAURI_PRIVATE_KEY }}
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD: $ {{ secrets.TAURI_KEY_PASSWORD }}
# ENABLE_CODE_SIGNING: $ {{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE: $ {{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE_PASSWORD: $ {{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# APPLE_SIGNING_IDENTITY: $ {{ secrets.APPLE_SIGNING_IDENTITY }}
# APPLE_PROVIDER_SHORT_NAME: $ {{ secrets.APPLE_PROVIDER_SHORT_NAME }}
# APPLE_API_ISSUER: $ {{ secrets.APPLE_API_ISSUER }}
# APPLE_API_KEY: $ {{ secrets.APPLE_API_KEY }}
# SENTRY_AUTH_TOKEN: $ {{ secrets.SENTRY_AUTH_TOKEN }}
- name: (Linux) Build Frontend
if: ${{ runner.os == 'Linux' }}
run: |
set -eux
XZ_OPT='-T0 -7' tar -cJf apps/frontend/dist.tar.xz -C apps/frontend/dist .
- name: Publish Artifacts
uses: ./.github/actions/publish-artifacts
with:
os: ${{ matrix.settings.os }}
arch: ${{ matrix.settings.arch }}
target: ${{ matrix.settings.target }}
profile: release
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
name: Create Release
needs: desktop
permissions:
contents: write
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
# - name: Create Relesae
# u

View file

@ -1,100 +0,0 @@
name: Cache
on:
push:
branches:
- main
paths-ignore:
- README.md
- CHANGELOG.md
- package.json
- LICENSE
- CONTRIBUTING.md
- TODO.md
- .editorconfig
- .vscode/*
- apps/frontend/*
- packages/distribution/*
- packages/client/*
- packages/patches/*
- packages/scripts/*
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- .github/workflows/cache.yml
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
jobs:
cache:
strategy:
fail-fast: true
matrix:
settings:
- host: macos-13
target: x86_64-apple-darwin
- host: macos-14
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: ubuntu-22.04
target: x86_64-unknown-linux-gnu
name: Make Cache
runs-on: ${{ matrix.settings.host }}
if: github.repository == 'polyfrost/onelauncher'
permissions: {}
timeout-minutes: 150
steps:
- name: (Linux) Maximize build space
if: ${{ runner.os == 'Linux' }}
uses: easimon/maximize-build-space@fc881a613ad2a34aca9c9624518214ebc21dfc0c
with:
swap-size-mb: 4096
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: (Windows) Setup Target
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
New-Item -ItemType Directory -Force -Path C:\onelauncher_target
New-Item -Path target -ItemType Junction -Value C:\onelauncher_target
- name: Setup System
uses: ./.github/actions/setup-system
with:
token: ${{ secrets.GITHUB_TOKEN }}
target: ${{ matrix.settings.target }}
save-cache: 'true'
- name: (Debug) Test
run: cargo test --workspace --all-features --no-run --locked --target ${{ matrix.settings.target }}
- name: (Release) Test
run: cargo test --workspace --all-features --no-run --locked --release --target ${{ matrix.settings.target }}
- name: (Debug) Build
run: cargo build --quiet --workspace --all-features --target ${{ matrix.settings.target }}
- name: (Release) Build
run: cargo build --quiet --workspace --all-features --release --target ${{ matrix.settings.target }}
- name: (Debug) Clippy
run: cargo clippy --workspace --all-features --target ${{ matrix.settings.target }}

43
.github/workflows/format.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name: Check Formatting
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]
merge_group:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
es:
name: ES Checks
runs-on: ubuntu-22.04
timeout-minutes: 7
permissions: {}
steps:
- name: Prepare Target
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1))" >> "${GITHUB_ENV}"
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Setup Pnpm
uses: ./.github/actions/setup-pnpm
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Linting
run: pnpm lint:es
clippy:
name: Rust Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --all-features