Skip to content

Lpa 23

Lpa 23 #128

Workflow file for this run

name: CI
on:
pull_request:
types:
- opened
- synchronize
- edited
branches:
- main
permissions:
checks: write
pull-requests: write
jobs:
analyse:
name: Analysis πŸ”
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: πŸ“‚ Checkout code
uses: actions/checkout@v2
- name: πŸ“ Extract flutter version
id: fvmrc
# get flutter key from .fvmrc file (file is in json format)
run: echo "FLUTTER_VERSION=$(jq -r '.flutter' .fvmrc)" >> $GITHUB_OUTPUT
- name: πŸš€ Set up Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ steps.fvmrc.outputs.FLUTTER_VERSION }}
- name: πŸ“¦ Get dependencies
run: flutter pub get
- name: πŸ” Analyze code
continue-on-error: true
run: flutter analyze --no-pub >> analysis.txt
- name: 🐍 Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.10'
- name: πŸ“ Construct analysis comment
run: python .github/workflows/construct_analysis_comment.py analysis.txt ${{ github.event.pull_request.head.sha }} ${{ github.event.number }} comment.txt
- name: 🀌 Create GitHub App Token
uses: actions/create-github-app-token@v1.11.5
id: token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: πŸ’¬ Post analysis comment
uses: peter-evans/create-or-update-comment@v3.1.0
with:
body-path: comment.txt
issue-number: ${{ github.event.pull_request.number }}
token: ${{ steps.token.outputs.token }}
- name: βœ… Annotate analysis results
uses: invertase/github-action-dart-analyzer@v3
test:
name: Testing πŸ§ͺ
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: πŸ“‚ Checkout code
uses: actions/checkout@v2
- name: πŸ“ Extract flutter version
id: fvmrc
# get flutter key from .fvmrc file (file is in json format)
run: echo "FLUTTER_VERSION=$(jq -r '.flutter' .fvmrc)" >> $GITHUB_OUTPUT
- name: πŸš€ Set up Flutter
uses: subosito/flutter-action@v1
with:
flutter-version: ${{ steps.fvmrc.outputs.FLUTTER_VERSION }}
- name: 🐍 Set up Python
uses: actions/setup-python@v4.7.1
with:
python-version: '3.10'
- name: πŸ“¦ Get dependencies
run: flutter pub get
- name: πŸ› οΈ Start Moodle mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/moodle.json
port: 6000
- name: 🌐 Start public API mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/public_api.json
port: 6008
- name: πŸ§ͺ Start unit tests mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/unit_tests.json
port: 3000
- name: πŸ—‚οΈ Start files mock server
uses: mockoon/cli-action@v1
with:
data-file: test/mockoon/files.json
port: 5000
- name: πŸ”„ Run tests
continue-on-error: true
run: flutter test --machine > test-results.json
- name: 🀌 Create GitHub App Token
uses: actions/create-github-app-token@v1.11.5
id: token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_PRIVATE_KEY }}
- name: πŸ“Š Annotate test results
uses: dorny/test-reporter@v1.9.1
id: reporter
with:
name: Test Results
path: test-results.json
reporter: dart-json
token: ${{ steps.token.outputs.token }}
- run: pip install requests
- name: πŸ“ Construct test comment
run: python .github/workflows/construct_unit_test_comment.py ${{ steps.reporter.outputs.url }} ${{ github.event.pull_request.head.sha }} comment.txt
- name: πŸ’¬ Post test comment
uses: peter-evans/create-or-update-comment@v3.1.0
with:
body-path: comment.txt
issue-number: ${{ github.event.pull_request.number }}
token: ${{ steps.token.outputs.token }}
validate-title:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
pull-requests: read
statuses: write
steps:
- uses: amannn/action-semantic-pull-request@505e44b4f33b4c801f063838b3f053990ee46ea7 # v4.6.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
build
chore
ci
docs
feat
fix
perf
refactor
revert
style
test
subjectPattern: ^[A-Z].+$
subjectPatternError: |
The subject of the PR must begin with an uppercase letter.