Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
s1n7ax committed Nov 13, 2023
0 parents commit 8efafe3
Show file tree
Hide file tree
Showing 40 changed files with 2,695 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace=true
max_line_length = 120
charset = utf-8

[*.yaml]
indent_size = 2

[*.md]
trim_trailing_whitespace=false
12 changes: 12 additions & 0 deletions .github/workflows/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Actionlint

on:
- pull_request

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-actionlint@v1
19 changes: 19 additions & 0 deletions .github/workflows/package-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Package lint

on:
- pull_request

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
mapfile -t EXTRA_FILES < <(find packages -type f -not -name package.yaml)
if [[ ${#EXTRA_FILES[@]} -gt 0 ]]; then
for file in "${EXTRA_FILES[@]}"; do
echo "::error file=${file},line=1::Only package.yaml files are allowed inside packages/."
done
exit 1
fi
109 changes: 109 additions & 0 deletions .github/workflows/package-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
name: Package tests

on:
pull_request:
workflow_dispatch:
inputs:
packages:
type: string
description: Space-separated list of package definitions to test.
required: true

jobs:
package-diff:
name: Check package diffs
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
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
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
79 changes: 79 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
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
29 changes: 29 additions & 0 deletions .github/workflows/validate-renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Validate Renovate config

on:
push:
branches:
- main
pull_request:

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check for config changes
id: diff
uses: tj-actions/changed-files@v36
with:
files: |
renovate.json5
- shell: bash
if: ${{ steps.diff.outputs.any_changed == 'true' }}
run: |
set +o pipefail
npx -y -p renovate -c renovate-config-validator \
| tee /dev/stderr \
| grep -Evz '(ERROR|could not be parsed)'
Loading

0 comments on commit 8efafe3

Please sign in to comment.