Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use new mason-org actions #16

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
validate:
name: Actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/package-lint.yaml

This file was deleted.

105 changes: 13 additions & 92 deletions .github/workflows/package-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,99 +11,20 @@ on:
required: true

jobs:
package-diff:
name: Check package diffs
lint:
name: Registry lint
runs-on: ubuntu-latest
outputs:
all_changed_files: ${{ steps.changed-packages.outputs.all_changed_files }}
any_changed: ${{ steps.changed-packages.outputs.any_changed }}

steps:
- uses: actions/checkout@v3
- name: Get changed package definitions
id: changed-packages
uses: tj-actions/changed-files@v36
with:
files: |
packages/**/package.yaml

validate:
name: Validate package definitions
runs-on: ubuntu-latest
needs: package-diff
if: ${{ github.event.inputs.packages || needs.package-diff.outputs.any_changed == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: mason-org/actions/validate-schema@v1
- uses: actions/checkout@v4
with:
packages: ${{ github.event.inputs.packages || needs.package-diff.outputs.all_changed_files }}

tests:
name: Test packages
needs: [package-diff, validate]
if: ${{ github.event.inputs.packages || needs.package-diff.outputs.any_changed == 'true' }}
strategy:
fail-fast: false
matrix:
# If making changes remember to update the manual workflow as well.
target:
- darwin_arm64
- darwin_x64
- linux_arm
- linux_arm64
- linux_arm64_gnu
- linux_arm_gnu
- linux_x64
- linux_x64_gnu
- linux_x86
- win_arm
- win_arm64
- win_x64
- win_x86

include:
- target: linux_x64
runs-on: ubuntu-latest
- target: linux_x64_gnu
runs-on: ubuntu-latest
- target: linux_x86
runs-on: ubuntu-latest
- target: linux_arm
runs-on: ubuntu-latest
- target: linux_arm_gnu
runs-on: ubuntu-latest
- target: linux_arm64
runs-on: ubuntu-latest
- target: linux_arm64_gnu
runs-on: ubuntu-latest
- target: darwin_x64
runs-on: macos-latest
- target: darwin_arm64
runs-on: macos-latest
- target: win_x64
runs-on: windows-latest
- target: win_x86
runs-on: windows-latest
- target: win_arm64
runs-on: windows-latest
- target: win_arm
runs-on: windows-latest

runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: mason-org/actions/tests@v1
fetch-depth: 1
- uses: mason-org/actions/registry-lint@v1
with:
packages: ${{ github.event.inputs.packages || needs.package-diff.outputs.all_changed_files }}
target: ${{ matrix.target }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# This job is used for branch protection rule
# Add this job to `Status checks that are required`
status-check:
name: Status check
runs-on: ubuntu-latest
needs: tests
if: 'failure() || cancelled()'
steps:
- run: exit 1
packages: ${{ github.event.inputs.packages }}

test:
name: Package tests
needs: lint
uses: mason-org/actions/.github/workflows/package-tests.yaml@v1
with:
packages: ${{ github.event.inputs.packages }}
65 changes: 1 addition & 64 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,14 @@ name: Release

on:
push:
tags:
- "**"
branches:
- main

jobs:
tag:
name: Tag
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag: ${{ steps.tag.outputs.tag }}
should-release: ${{ steps.tag.outputs.should-release }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- id: adjnoun
uses: mason-org/actions/adj-noun-generator@v1
- id: tag
name: Get/create tag
shell: bash
run: |
if [[ $GITHUB_REF =~ ^refs/tags ]]; then
echo "Releasing tag $GITHUB_REF_NAME"
printf "tag=%s\nshould-release=true" "$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
elif [[ $(git diff-tree --name-only --no-commit-id HEAD -- packages | wc -l) -gt 0 ]]; then
declare TAG
TAG=$(date +%Y-%m-%d)-$ADJNOUN
printf "tag=%s\nshould-release=true" "$TAG" >> "$GITHUB_OUTPUT"
echo "Tagging and pushing $TAG"
git tag "$TAG" HEAD
git push origin "$TAG"
else
echo "No tag was pushed, and no package definition was changed."
echo "should-release=false" >> "$GITHUB_OUTPUT"
fi
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_REF_NAME: ${{ github.ref_name }}
ADJNOUN: ${{ steps.adjnoun.outputs.word }}

release:
needs: [tag]
if: ${{ needs.tag.outputs.should-release == 'true' }}
name: Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
- name: Set up yq
shell: bash
run: |
sudo curl -fL "https://github.com/mikefarah/yq/releases/download/v4.30.6/yq_linux_amd64" -o /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
- name: Compile
shell: bash
run: |
yq ea '[.]' -o json packages/*/package.yaml > registry.json
zip -r registry.json.zip registry.json
sha256sum registry.json registry.json.zip > checksums.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.tag.outputs.tag }}
fail_on_unmatched_files: true
generate_release_notes: false
files: |
registry.json.zip
checksums.txt
- uses: mason-org/actions/registry-release@v1
1 change: 1 addition & 0 deletions .github/workflows/validate-renovate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
validate:
name: Validate Renovate config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

# Schema

Package definitions are validated against a well-defined [JSON schema](./schemas/). The full schema is hosted on
<http://schemastore.org/>.
Package definitions are validated against a well-defined [JSON schema](https://github.com/mason-org/registry-schema).
The full schema is hosted on <http://schemastore.org/>.

<sup>
Use <a href="https://github.com/b0o/SchemaStore.nvim">b0o/SchemaStore.nvim</a> and the YAML language server to
Expand Down
101 changes: 1 addition & 100 deletions renovate.json5
Original file line number Diff line number Diff line change
@@ -1,102 +1,3 @@
{
automerge: true,
dependencyDashboard: true,
platformAutomerge: true,
automergeType: "pr",
commitMessage: "bump({{decodeURIComponent depName}}): update {{commitMessageExtra}}",
separateMajorMinor: false,
prHourlyLimit: 0,
prConcurrentLimit: 0,
branchConcurrentLimit: 0,
rebaseWhen: "conflicted",
enabledManagers: ["regex"],
regexManagers: [
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\n id:\\s+pkg:github\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
"\nname: (?<depName>.+)",
"# renovate:datasource=git-refs[\\s\\S]*pkg:github\\/(?<packageName>.+)@(?<currentDigest>[^\\s\\?#]+)",
"# renovate:.*versioning=(?<versioning>[^,\n]+)",
"# renovate:.*datasource=(?<datasource>[^,\n]+)",
],
datasourceTemplate: "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}",
versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
packageNameTemplate: "{{#if (containsString datasource 'git-refs')}}https://github.com/{{{packageName}}}{{else}}{{{packageName}}}{{/if}}",
currentValueTemplate: "{{#if (containsString datasource 'git-refs')}}{{else}}{{currentValue}}{{/if}}",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:cargo\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
"\\?.*repository_url=(?<githubRepo>https:\\/\\/github\\.com)\\/(?<packageName>[^\\s&]+)",
"# renovate:.*versioning=(?<versioning>[^,\n]+)",
],
datasourceTemplate: "{{#if githubRepo}}github-tags{{else}}crate{{/if}}",
// In cargo versioning, "1.2.3" doesn't mean "exactly 1.2.3" but rather ">=1.2.3 <2.0.0".
// We on the other hand do want to treat versions as fixed - so we change versioning strategy.
versioningTemplate: "semver",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:golang\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
],
datasourceTemplate: "go",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:gem\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
],
datasourceTemplate: "rubygems",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:composer\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
],
datasourceTemplate: "packagist",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:(?<datasource>npm|pypi|nuget)\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
],
datasourceTemplate: "{{datasource}}",
},
{
fileMatch: "package\\.yaml$",
matchStringsStrategy: "combination",
matchStrings: [
"\nname: (?<depName>.+)",
"\n id:\\s+pkg:generic\\/(?<packageName>.+)@(?<currentValue>[^\\s\\?#]+)",
"# renovate:.*versioning=(?<versioning>[^,\n]+)",
"# renovate:.*datasource=(?<datasource>[^,\n]+)",
],
datasourceTemplate: "{{{datasource}}}",
versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}",
},
],
packageRules: [
{
matchDepNames: ["cucumber-language-server"],
allowedVersions: "!/^1\\.[34]\\.0/"
},
{
matchDepNames: ["rustfmt"],
allowedVersions: "<=1.5.1"
}
]
extends: ["github>mason-org/registry-renovate-config"]
}
11 changes: 0 additions & 11 deletions schemas/components/bin.json

This file was deleted.

17 changes: 0 additions & 17 deletions schemas/components/deprecation.json

This file was deleted.

11 changes: 0 additions & 11 deletions schemas/components/opt.json

This file was deleted.

13 changes: 0 additions & 13 deletions schemas/components/schemas.json

This file was deleted.

Loading
Loading