Add workflows and sync configuration (#2)

* Add workflows and sync configuration

* Trigger Build

* Trying to exclude basic-linters.yml

* Add newway in default group for testing

* Fix workflow reference for thrift build

* Add repo list sync action

* Add only source parameter

* Trying with one line string

* Trying with one line string without EOF

* Fix with foreach

* Temporary switch base branch to dev branch

* Finalyze actions and settings
This commit is contained in:
Pavel Popov 2022-02-28 15:14:33 +03:00 committed by GitHub
parent b11d6471a7
commit 8702fd7ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 218 additions and 0 deletions

2
.github/settings.yml vendored Normal file
View File

@ -0,0 +1,2 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
_extends: .github

30
.github/sync.yml vendored Normal file
View File

@ -0,0 +1,30 @@
group:
- id: default
files:
- source: workflows/base/basic-linters.yml
dest: .github/workflows/basic-linters.yml
- source: LICENSE
dest: LICENSE
- source: .github/settings.yml
replace: false
repos: |-
valitydev/damsel
valitydev/newway
- id: proto
files:
- source: workflows/proto/
dest: .github/workflows/
deleteOrphaned: true
exclude: |
basic-linters.yml
repos: |-
valitydev/damsel
- id: java
files:
- source: codeowners/java
dest: CODEOWNERS
replace: false
repos: |-
valitydev/newway

20
.github/workflows/sync-files.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Sync files
on:
pull_request:
push:
branches:
- master
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v2
- name: 🔄 Sync repo files
uses: valitydev/repo-file-sync-action@v1
with:
GH_PAT: ${{ secrets.GH_PAT }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
BRANCH_PREFIX: update/

83
.github/workflows/sync-repo-list.yml vendored Normal file
View File

@ -0,0 +1,83 @@
name: Sync repo list in sync.yml file
on:
push:
branches:
- master
- main
schedule:
- cron: 0 * * * *
env:
repo_limit: 1000
jobs:
workflows-sync:
name: Sync repositories for ${{ matrix.group }} group
runs-on: ubuntu-latest
strategy:
matrix:
include:
- group: default
languages: >-
all
- group: proto
languages: >-
thrift
- group: java
languages: >-
java
kotlin
steps:
- name: ⤵️ Check out code
uses: actions/checkout@v2
- name: 📤 Get a list of repositories for ${{ matrix.group }} group
id: repo-list
run: |
REPOSITORIES=""
for language in ${{ matrix.languages }}; do
LANGUAGE_ARGS=""
if [[ $language != "all" ]]; then
LANGUAGE_ARGS="-l $language"
fi
REPOSITORIES+=$(gh repo list \
$OWNER \
--source \
--no-archived \
-L $repo_limit \
$LANGUAGE_ARGS \
--json name,owner \
-q '.|=sort_by(.name)| .[] | [.owner.login, .name] | join("/")')
REPOSITORIES+=" "
done
REPOSITORIES=$(echo $REPOSITORIES | sort | uniq | tr " " "\n")
REPOSITORIES="${REPOSITORIES//'%'/'%25'}"
REPOSITORIES="${REPOSITORIES//$'\n'/'%0A'}"
REPOSITORIES="${REPOSITORIES//$'\r'/'%0D'}"
echo "::set-output name=repositories::$REPOSITORIES"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: 🔄 Update sync.yml file for ${{ matrix.group }} group
uses: fjogeleit/yaml-update-action@master
with:
valueFile: ".github/sync.yml"
propertyPath: >-
$.group[?(@.id == "${{ matrix.group }}")].repos
value: ${{ steps.repo-list.outputs.repositories }}
updateFile: true
commitChange: false
- name: 📤 Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
base: master
branch: updates/${{ matrix.group }}
title: "Update repo list for ${{ matrix.group }} group"
commit-message: "Update repo list for ${{ matrix.group }} group"
add-paths: |
.github/sync.yml

1
codeowners/java Normal file
View File

@ -0,0 +1 @@
* @valitydev/java

View File

@ -0,0 +1,11 @@
name: Vality auto-tags
on:
push:
branches:
- "master"
- "main"
jobs:
tag-action:
uses: valitydev/base-workflows/.github/workflows/auto-tag.yml@v1

View File

@ -0,0 +1,10 @@
name: Vality basic linters
on:
pull_request:
branches:
- "*"
jobs:
lint:
uses: valitydev/base-workflows/.github/workflows/basic-linters.yml@v1

View File

@ -0,0 +1,34 @@
name: Erlang build
on:
pull_request:
branches:
- "*"
jobs:
build:
name: Build and verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: valitydev/action-setup-thrift@v1
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: "24"
rebar3-version: "3.18"
- name: Restore PLT cache
uses: actions/cache@v2
id: plt-cache
with:
key: |
${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-plt
path: |
_build/default/rebar3_*_plt
- run: rebar3 compile
- run: rebar3 xref
- run: rebar3 dialyzer

View File

@ -0,0 +1,17 @@
name: Java deploy
on:
push:
branches:
- "master"
- "main"
jobs:
deploy:
uses: valitydev/java-workflow/.github/workflows/maven-thrift-deploy.yml@v1
secrets:
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
deploy-secret-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
deploy-secret-key-password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
mm-webhook-url: ${{ secrets.MATTERMOST_WEBHOOK_URL }}

View File

@ -0,0 +1,10 @@
name: Java build
on:
pull_request:
branches:
- "*"
jobs:
build:
uses: valitydev/java-workflow/.github/workflows/maven-thrift-build.yml@v1