Skip to content

Commit

Permalink
Merge pull request #21 from gibahjoe/feat/github-actions
Browse files Browse the repository at this point in the history
Adding GitHub actions
  • Loading branch information
gibahjoe committed Feb 19, 2023
2 parents dcd788e + 171f767 commit ac0ee36
Show file tree
Hide file tree
Showing 9 changed files with 463 additions and 1 deletion.
89 changes: 89 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Bug Report
description: You have noticed a general issue or regression, and would like to report it
labels: [bug]

body:
- type: markdown
attributes:
value: |
Thank you for taking the time to fill out this bug report!
Please note that contributor time is limited, and we might not get back to you immediately.
Also make sure to check if [an existing issue](https://github.com/gibahjoe/keycloak_flutter/issues) matches yours.
- type: textarea
attributes:
label: Description of the bug
description: Provide a clear and concise description of the bug.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Explain how a maintainer can reliably reproduce the bug.
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: Provide a clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Logs
description: If relevant, provide **browser** logs indicating an error.
render: text
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
- type: dropdown
attributes:
label: Platform
options:
- Linux
- Windows
- macOS
- Android
- iOS
validations:
required: true
- type: dropdown
attributes:
label: Browser
options:
- Firefox
- Chrome
- Safari
- Edge
- Other (Please specify in the "additional context" section)
validations:
required: true
- type: input
attributes:
label: Keycloak web version
placeholder: 10.7.6
validations:
required: true
- type: input
attributes:
label: Keycloak flutter version
placeholder: 10.7.6
validations:
required: true
- type: input
attributes:
label: Flutter version
placeholder: 3.3
validations:
required: true
- type: input
attributes:
label: Flutter channel
placeholder: stable
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: If necessary, provide any further context or information.
render: text
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
11 changes: 11 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
github_actions:
- '.github/workflows/*'

service:
- 'lib/src/keycloak_service.dart'
plugin:
- 'lib/keycloak_flutter.dart'
interop:
- 'lib/src/keycloak.dart'
dependencies:
- 'pubspec.yaml'
72 changes: 72 additions & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Automation 🤖

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
push:
branches:
- master
paths-ignore:
- '**/*.md'
pull_request_target:

jobs:
compose-comment:
name: Compose PR comment
if: ${{ always() && !cancelled() && github.event_name == 'pull_request_target' }}
uses: ./.github/workflows/job_messages.yml
with:
commit: ${{ github.event.pull_request.head.sha }}
commenting_workflow_run_id: ${{ github.run_id }}
in_progress: true

push-comment:
name: Push comment to PR 🖥️
if: |
always() &&
!cancelled() &&
github.event_name == 'pull_request_target' &&
needs.compose-comment.result == 'success'
runs-on: ubuntu-latest
needs:
- compose-comment

steps:
- name: Create comment
uses: thollander/actions-comment-pull-request@v2.3.0
with:
GITHUB_TOKEN: ${{ secrets.KC_FLUTTER_BOT_TOKEN }}
message: ${{ needs.compose-comment.outputs.msg }}
comment_tag: ${{ needs.compose-comment.outputs.marker }}
mode: recreate

project:
name: Project board 📊
runs-on: ubuntu-latest
steps:
- uses: alex-page/github-project-automation-plus@v0.8.2
if: ${{ github.event_name == 'pull_request_target' }}
continue-on-error: true
with:
project: Ongoing development
column: In progress
repo-token: ${{ secrets.KC_FLUTTER_BOT_TOKEN }}

label:
name: Labeling 🏷️
runs-on: ubuntu-latest
steps:
- name: Label PR depending on modified files
uses: actions/labeler@v4
if: ${{ github.event_name == 'pull_request_target' }}
continue-on-error: true
with:
repo-token: '${{ secrets.KC_FLUTTER_BOT_TOKEN }}'

- name: Check all PRs for merge conflicts ⛔
uses: eps1lon/actions-label-merge-conflict@v2.1.0
with:
dirtyLabel: 'merge conflict'
repoToken: ${{ secrets.KC_FLUTTER_BOT_TOKEN }}
109 changes: 109 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Quality checks 👌🧪

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- '**/*.md'
workflow_dispatch:

jobs:
# dependency-review:
# name: Vulnerable dependencies 🔎
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v3.2.0
#
# - name: Scan
# uses: actions/dependency-review-action@v3.0.2

# lint:
# name: Lint 🔬
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout ⬇️
# uses: actions/checkout@v3.2.0
#
# - name: Setup node environment ⚙️
# uses: actions/setup-node@v3.5.1
# with:
# node-version: 16
# cache: 'npm'
# check-latest: true
#
# - name: Install dependencies 📦
# run: npm ci --no-audit
#
# - name: Run linter ✏️
# run: 'npm run lint:js && npm run lint:style'

build:
name: Build frontend 🛠️
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
working-directory: example

steps:
- name: Checkout ⬇️
uses: actions/checkout@v3

- name: Build Example Project 🛠
uses: subosito/flutter-action@v2
with:
cache: true
channel: 'stable'
- run: flutter pub get
# - run: flutter test
- run: flutter build web

- name: Upload artifact (Client) ⬆️💻
uses: actions/upload-artifact@v3.1.1
with:
name: example
path: |
example/build/web
pr_context:
name: Save PR context as artifact
if: ${{ always() && !cancelled() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs:
# - dependency-review
- build

steps:
- name: Save PR context
env:
PR_NUMBER: ${{ github.event.number }}
PR_SHA: ${{ github.sha }}
run: |
echo $PR_NUMBER > PR_number
echo $PR_SHA > PR_sha
- name: Upload PR number as artifact
uses: actions/upload-artifact@v3.1.1
with:
name: PR_context
path: |
PR_number
PR_sha
conventional_commits:
name: Conventional commits check 💬
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest

steps:
- name: Checkout ⬇️
uses: actions/checkout@v3.2.0

- name: Check if all commits comply with the specification
uses: webiny/action-conventional-commits@v1.1.0
93 changes: 93 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Deploy 🏗️

on:
workflow_run:
workflows:
- Quality checks 👌🧪
types:
- completed

jobs:
cf-pages:
name: CloudFlare Pages 📃
runs-on: ubuntu-latest
outputs:
url: ${{ steps.cf.outputs.url }}

steps:
- name: Download workflow artifact ⬇️
uses: dawidd6/action-download-artifact@v2.24.2
with:
run_id: ${{ github.event.workflow_run.id }}
name: example
path: example/build/web

- name: Publish to Cloudflare Pages 📃
uses: cloudflare/pages-action@v1.3.0
id: cf
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: kc-flutter
directory: example/build/web
branch: ${{ github.event.workflow_run.head_branch }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

pr-context:
name: Get PR context
if: ${{ always() && github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
commit: ${{ env.pr_sha }}
pr_number: ${{ env.pr_number }}

steps:
- name: Get PR context ⬇️
uses: dawidd6/action-download-artifact@v2.24.2
id: pr_context
with:
run_id: ${{ github.event.workflow_run.id }}
name: PR_context

- name: Set PR context environment variables
if: ${{ steps.pr_context.conclusion == 'success' }}
run: |
echo "pr_number=$(cat PR_number)" >> $GITHUB_ENV
echo "pr_sha=$(cat PR_sha)" >> $GITHUB_ENV
compose-comment:
name: Compose comment
if: ${{ always() }}
uses: ./.github/workflows/job_messages.yml
needs:
- cf-pages
- pr-context

with:
branch: ${{ github.event.workflow_run.head_branch }}
commit: ${{ needs.pr-context.outputs.commit != '' && needs.pr-context.outputs.commit || github.event.workflow_run.head_sha }}
preview_url: ${{ needs.cf-pages.outputs.url }}
build_workflow_run_id: ${{ github.event.workflow_run.id }}
commenting_workflow_run_id: ${{ github.run_id }}
in_progress: false

comment-status:
name: Create comment status
if: |
always() &&
github.event.workflow_run.event == 'pull_request' &&
needs.pr-context.outputs.pr_number != ''
runs-on: ubuntu-latest
needs:
- compose-comment
- pr-context

steps:
- name: Update job summary in PR comment
uses: thollander/actions-comment-pull-request@v2.3.0
with:
GITHUB_TOKEN: ${{ secrets.KC_FLUTTER_BOT_TOKEN }}
message: ${{ needs.compose-comment.outputs.msg }}
pr_number: ${{ needs.pr-context.outputs.pr_number }}
comment_tag: ${{ needs.compose-comment.outputs.marker }}
mode: recreate
Loading

0 comments on commit ac0ee36

Please sign in to comment.