mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-27 14:47:50 -03:00
Merge commit 'f955c625aded244864e83a872b396868a490dbc5' as 'go-enry'
This commit is contained in:
52
go-enry/.github/workflows/goTest.yml
vendored
Normal file
52
go-enry/.github/workflows/goTest.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
on: [push, pull_request]
|
||||
name: Go Tests
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set git on win to use LF
|
||||
run: |
|
||||
git config --global core.autocrlf false
|
||||
git config --global core.eol lf
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
run: go test ./...
|
||||
env:
|
||||
ENRY_DEBUG: 1
|
||||
|
||||
test-oniguruma:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ONIGURUMA_VERSION: 6.9.4
|
||||
steps:
|
||||
- name: Install libonig5
|
||||
run: |
|
||||
wget "http://archive.ubuntu.com/ubuntu/pool/universe/libo/libonig/libonig5_${ONIGURUMA_VERSION}-1_amd64.deb"
|
||||
sudo dpkg -i "libonig5_${ONIGURUMA_VERSION}-1_amd64.deb"
|
||||
wget "http://archive.ubuntu.com/ubuntu/pool/universe/libo/libonig/libonig-dev_${ONIGURUMA_VERSION}-1_amd64.deb"
|
||||
sudo dpkg -i "libonig-dev_${ONIGURUMA_VERSION}-1_amd64.deb"
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Test
|
||||
run: go test -tags ${GO_TAGS} ./...
|
||||
env:
|
||||
GO_TAGS: oniguruma
|
32
go-enry/.github/workflows/pyTest.yml
vendored
Normal file
32
go-enry/.github/workflows/pyTest.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
on: [push, pull_request]
|
||||
name: Python Tests
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.8', '3.9', '3.10']
|
||||
platform: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.19.x
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r python/requirements.txt
|
||||
if [ -f python/requirements.dev.txt ]; then pip install -r python/requirements.dev.txt; fi
|
||||
- name: Build and install package
|
||||
run: |
|
||||
pip install setuptools wheel
|
||||
pip -v install --no-use-pep517 -e python
|
||||
- name: Test
|
||||
run: |
|
||||
pytest python/
|
130
go-enry/.github/workflows/sync-linguist.yml
vendored
Normal file
130
go-enry/.github/workflows/sync-linguist.yml
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
name: Sync Linguist
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
linguist_tag:
|
||||
description: 'Linguist tag override'
|
||||
required: False
|
||||
default: ''
|
||||
schedule:
|
||||
# Run once a day to check for new Linguist updates automatically
|
||||
- cron: '0 20 * * *'
|
||||
|
||||
jobs:
|
||||
sync-linguist:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/checkout@v2
|
||||
- name: Find previous Linguist commit
|
||||
id: previous_linguist
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
commit=$(sed --quiet --regexp-extended 's/[[:space:]]+commit[[:space:]]+=[[:space:]]"([a-f0-9]{40})"/\1/p' internal/code-generator/generator/generator_test.go)
|
||||
echo "::set-output name=commit::$commit"
|
||||
echo "::set-output name=short_commit::${commit::8}"
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: github/linguist
|
||||
path: .linguist
|
||||
fetch-depth: 0
|
||||
- name: check out latest release
|
||||
id: linguist-release
|
||||
# the `grep -v "-"` is to exclude any pre-release versions.
|
||||
# Linguist doesn't have any right now, but just in case.
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
cd .linguist
|
||||
if [[ -n "${{ github.event.inputs.linguist_tag }}" ]]; then
|
||||
echo "Using tag override '${{ github.event.inputs.linguist_tag }}'"
|
||||
latest="${{ github.event.inputs.linguist_tag }}"
|
||||
else
|
||||
latest=$(git tag --list | \
|
||||
grep -v "-" | \
|
||||
sort --version-sort --reverse | \
|
||||
head -1)
|
||||
fi
|
||||
|
||||
if [[ -z "$latest" ]]; then
|
||||
echo "could not determine latest Linguist version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "::set-output name=linguist_version::$latest"
|
||||
git checkout $latest
|
||||
|
||||
commit=$(git rev-parse HEAD)
|
||||
if [[ -z "$commit" ]]; then
|
||||
echo "could not determine latest Linguist commit"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "::set-output name=commit::$commit"
|
||||
echo "::set-output name=short_commit::${commit::8}"
|
||||
|
||||
cd ..
|
||||
- name: Update Linguist information
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
sed --in-place --regexp-extended 's/(commit[[:space:]]+=[[:space:]])("[a-f0-9]{40}")/\1"${{ steps.linguist-release.outputs.commit }}"/' internal/code-generator/generator/generator_test.go
|
||||
sed --in-place --regexp-extended 's/version \*\*v.+\*\*\./version \*\*${{ steps.linguist-release.outputs.linguist_version }}\*\*\./' README.md
|
||||
- name: Generate code
|
||||
run: make code-generate
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
echo "git current state:"
|
||||
git status
|
||||
|
||||
branch_name="feature/sync-linguist-${{ steps.previous_linguist.outputs.short_commit }}"
|
||||
if git rev-parse --quiet --verify $branch_name; then
|
||||
echo "Linguist update branch $branch_name already exists"
|
||||
echo "::set-output name=needs_pr::true"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -n "$(git status --porcelain)" ]]; then
|
||||
echo "Creating branch $branch_name for PR"
|
||||
git checkout -b $branch_name
|
||||
echo "::set-output name=branch_name::$branch_name"
|
||||
echo "Creating Linguist update commit"
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
git add .
|
||||
git commit -m "Updated Linguist to ${{ steps.linguist-release.outputs.linguist_version }}"
|
||||
git push --set-upstream origin $branch_name
|
||||
echo "Changes committed. Will create PR."
|
||||
echo "::set-output name=needs_pr::true"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Linguist update unnecessary"
|
||||
echo "::set-output name=needs_pr::false"
|
||||
- name: Create Pull Request
|
||||
id: open-pr
|
||||
uses: repo-sync/pull-request@v2
|
||||
if: ${{ steps.commit.outputs.needs_pr == 'true' }}
|
||||
with:
|
||||
source_branch: ${{ steps.commit.outputs.branch_name }}
|
||||
pr_title: "Update Linguist to ${{ steps.linguist-release.outputs.linguist_version }}"
|
||||
pr_body: |
|
||||
Automated Linguist update :robot:
|
||||
|
||||
This PR updates Linguist from [${{ steps.previous_linguist.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.previous_linguist.outputs.commit }}) to [${{ steps.linguist-release.outputs.linguist_version }}](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }}) ([${{ steps.linguist-release.outputs.short_commit }}](https://github.com/github/linguist/commit/${{ steps.linguist-release.outputs.commit }}))
|
||||
|
||||
* [Linguist release notes](https://github.com/github/linguist/releases/tag/${{ steps.linguist-release.outputs.linguist_version }})
|
||||
* [Compare Linguist code changes](https://github.com/github/linguist/compare/${{ steps.previous_linguist.outputs.commit }}...${{ steps.linguist-release.outputs.linguist_version }})
|
||||
destination_branch: "master"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: output-url
|
||||
if: ${{ steps.commit.outputs.needs_pr == 'true' }}
|
||||
run: echo ${{ steps.open-pr.outputs.pr_url }}
|
||||
- name: No PR Created
|
||||
if: ${{ steps.commit.needs_pr != 'true' }}
|
||||
run: echo "No changes for ${{ steps.linguist-release.outputs.linguist_version }}"
|
Reference in New Issue
Block a user