Skip to content

Commit

Permalink
ci: Automate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed Feb 23, 2024
1 parent f7d8b95 commit a79c207
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build app
name: build client
on:
workflow_dispatch:
inputs:
Expand All @@ -10,8 +10,6 @@ on:
options:
- 'any'
- '3.16.x'
- '3.13.x'
- '3.10.x'
enable_android:
description: 'Build Android'
required: false
Expand Down Expand Up @@ -51,7 +49,7 @@ on:
inputs:
flutter_version:
required: false
default: '3.16.2'
default: '3.16.9'
type: string
enable_android:
required: false
Expand Down Expand Up @@ -98,6 +96,7 @@ jobs:
working-directory: ./wrestling_scoreboard_client
run: |
flutter build web \
--build-name=0.0.0-nightly.$(echo $GITHUB_SHA::7) \
--base-href ${{ inputs.upload_pages_artifact && '"/wrestling_scoreboard/"' || '"/"' }} \
--dart-define=API_URL=https://server.wrestling-scoreboard.oberhauser.dev/api \
--dart-define=WEB_SOCKET_URL=wss://server.wrestling-scoreboard.oberhauser.dev/ws
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/build-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build server
on:
workflow_dispatch:
inputs:
flutter_version:
description: 'Flutter Version'
required: false
default: 'any'
type: choice
options:
- 'any'
- '3.16.x'
workflow_call:
inputs:
flutter_version:
required: false
default: '3.16.9'
type: string

jobs:
build-server:
name: Build Server for ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: windows-latest
platform: windows
- os: macos-latest
platform: macos
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter_version }}
channel: 'stable'
- name: Build
id: build
shell: bash
run: |
ARTIFACT_PATH=$(./build.sh -v 0.0.0-nightly.$(echo $GITHUB_SHA::7) | tail -1)
ARTIFACT_NAME=$(basename "$ARTIFACT_PATH")
echo "artifact-path=$(echo $ARTIFACT_PATH)" >> $GITHUB_OUTPUT
echo "artifact-name=$(echo $ARTIFACT_NAME)" >> $GITHUB_OUTPUT
working-directory: wrestling_scoreboard_server
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
call-build-client:
uses: ./.github/workflows/build-app.yml
uses: ./.github/workflows/build-client.yml
with:
upload_pages_artifact: true

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pull-request
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
call-test:
uses: ./.github/workflows/test.yml
call-build-server:
needs:
- call-test
uses: ./.github/workflows/build-server.yml
call-build-client:
needs:
- call-test
uses: ./.github/workflows/build-client.yml
with:
enable_android: ${{ github.event.pull_request.draft == false }}
enable_web: ${{ github.event.pull_request.draft == false }}
enable_ios: ${{ github.event.pull_request.draft == false }}
enable_windows: ${{ github.event.pull_request.draft == false }}
enable_linux: ${{ github.event.pull_request.draft == false }}
enable_macos: ${{ github.event.pull_request.draft == false }}
upload_pages_artifact: false
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.2'
flutter-version: '3.16.9'
channel: 'stable'
- name: Build
id: build
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.2'
flutter-version: '3.16.9'
channel: 'stable'
- name: Install Linux Dependencies
run: |
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: test
on:
workflow_dispatch:
inputs:
flutter_version:
description: 'Flutter Version'
required: false
default: 'any'
type: choice
options:
- 'any'
- '3.16.x'
flutter_channel:
description: 'Flutter Channel'
required: false
default: 'stable'
type: choice
options:
- 'stable'
- 'beta'
- 'dev'
- 'master'
fatal_warnings:
description: 'Treat warnings as fatal'
required: false
default: true
type: boolean

workflow_call:
inputs:
flutter_version:
required: false
default: '3.16.8'
type: string
flutter_channel:
required: false
default: 'stable'
type: string
fatal_warnings:
required: false
default: true
type: boolean

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter_version }}
channel: ${{ inputs.flutter_channel }}
- uses: bluefireteam/melos-action@main
- run: melos run format-check
- run: melos run analyze -- ${{ inputs.fatal_warnings && '--fatal-infos' || '--no-fatal-warnings --no-fatal-infos' }}
- run: melos run test

0 comments on commit a79c207

Please sign in to comment.