Skip to content

Commit

Permalink
Merge pull request #92 from sliit-foss/development
Browse files Browse the repository at this point in the history
Graduation
  • Loading branch information
Akalanka47000 committed Oct 15, 2023
2 parents bb66e30 + d852e48 commit 8ca981d
Show file tree
Hide file tree
Showing 45 changed files with 977 additions and 143 deletions.
66 changes: 66 additions & 0 deletions .github/actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: release
description: Base package release action
inputs:
credentials:
description: 'Pub.dev credentials'
required: true
options:
description: 'Melos version options'
required: false
runs:
using: composite
steps:
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: 3.x
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'

- name: Configure git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
shell: bash

- name: Install dependencies
run: |
dart pub global activate melos
flutter pub get
melos bootstrap
shell: bash

- name: Setup Pub Credentials
run: |
mkdir -p ~/.config
cd ~/.config
mkdir dart
echo "${{ inputs.credentials }}" | base64 --decode > ~/.config/dart/pub-credentials.json
shell: bash

- name: Populate prerequisities
run: |
for dir in packages; do
cd "$dir" && for p in */; do
cp ../{.pubignore,LICENSE} "$p"
done && cd ..
done
shell: bash

- name: Bump versions
run: |
melos version --yes --message="CI: sync release" --diff=$(git log --skip=1 -n 1 --pretty=format:"%H") ${{ inputs.options }}
shell: bash

- name: Publish packages
run: melos publish --no-published --no-dry-run --yes
shell: bash

- name: Update release info
run: |
git add . && git commit --amend --no-edit || true
git config pull.ff true
git pull --rebase && git push origin
shell: bash
24 changes: 24 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test
description: Base unit test action
runs:
using: composite
steps:
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
flutter-version: 3.x
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'

- name: Install dependencies
run: |
dart pub global activate melos
flutter pub get
melos bootstrap
shell: bash

- name: Execute tests
run: melos exec --diff=$(git log --skip=1 -n 1 --pretty=format:"%H") -- flutter test
shell: bash
35 changes: 35 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI Prerelease

on:
push:
branches:
- development

jobs:
unit-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Tests 🧪
uses: ./.github/actions/test

release:
name: Release packages
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Initiate release 📦
uses: ./.github/actions/release
with:
credentials: ${{ secrets.PUB_CREDENTIALS }}
options: "--prerelease --preid=blizzard"
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI Release

on:
push:
branches:
- main

jobs:
unit-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Tests 🧪
uses: ./.github/actions/test

release:
name: Release packages
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Initiate release 📦
uses: ./.github/actions/release
with:
credentials: ${{ secrets.PUB_CREDENTIALS }}
options: "--graduate"
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI Tests

on:
pull_request:

jobs:
unit-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Tests 🧪
uses: ./.github/actions/test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ doc/api/

.flutter-plugins
.flutter-plugins-dependencies

packages/**/LICENSE
packages/**/.pubignore
packages/**/doc
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
. "$(dirname -- "$0")/_/husky.sh"

dart format . --fix
dart run lint_staged
dart run lint_staged
git add .
3 changes: 3 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ test/
.gitignore
analysis_options.yaml
pub_login.sh
melos_flodash.iml
CHANGELOG.md
CONTRIBUTING.md
Loading

0 comments on commit 8ca981d

Please sign in to comment.