Skip to content

Commit

Permalink
chore: remove betamax and upgrade deps (#119)
Browse files Browse the repository at this point in the history
* chore: fix formatting

* chore: update melos to `3.2.0` and http to `1.1.0`

* chore: remove references to betamax

* chore: upgrade deps

* chore: fix tests

* chore: use DotEnv to parse .env file

* chore: add local nhost project for running test

* test: add serverless functions for testing

* chore: configure test to run against local nhost project

* chore: clear users after running test

* chore: fix mfa tests

* chore: fix storage tests

* chore: remove http fixtures

* chore: remove old testing project

* chore: move testing project under the nhost_dart package

* chore: use different test emails for auth and storage tests

* chore: add GITHUB_TOKEN to avoid rate limiting when checking for broken links

* chore: fix links

* chore: fix ci workflows

* chore: fix formatting

* chore: fix static analysis issues

* chore(ci): add steps to install nhost cli and start the test_backend

* chore: fix path to test_backend project

* chore: remove `.secrets` from `.gitignore`

* chore: run tests with `sudo`

* chore: run flutter test with `sudo`

* chore(ci): add step to install sudo package

* Revert "chore(ci): add step to install sudo package"

This reverts commit 78bbee8.

* chore: ci: run flutter test with no `sudo`

* chore: ci: run melos using sudo with full path

* chore: ci: make sure dart is present in path when running tests

* chore: ci: comment out storage tests

* chore: ci: override nhost data-folder path

* chore: ci: wait 5 before running the tests

* chore: remove sleep command in workflow

* chore: fix command syntax in test.nhost_dart.yaml

* chore: restore storage_test.dart

* chore: update graphql dependency version

* fix: typo in GitHub token variable in
test.nhost_functions_dart.yaml

* fix(tests): clear users before running storage test
  • Loading branch information
onehassan authored Nov 8, 2023
1 parent 66825b7 commit 80a4a0f
Show file tree
Hide file tree
Showing 213 changed files with 2,274 additions and 6,361 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/check_broken_links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
LYCHEE_OUT: tmp/lychee_results.md
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@master
- name: Check links
Expand All @@ -26,3 +27,4 @@ jobs:
**/*.md
**/*.yaml
**/*.dart
--github-token $GITHUB_TOKEN
196 changes: 90 additions & 106 deletions .github/workflows/test.nhost_auth_dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Instantiations of this template are produced by the Melos postbootstrap script
# which can be found in `melos.yaml`.

name: 'nhost_auth_dart tests'
name: "nhost_auth_dart tests"
on:
push:
branches:
Expand All @@ -19,122 +19,106 @@ on:
branches:
- main
# schedule:
# Run the quality job at 4am every day
# - cron: '0 4 * * *'
# Run the quality job at 4am every day
# - cron: '0 4 * * *'

env: {}
jobs:
# Ensure that the package meets a suitably high pub.dev score
score-package-quality:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# We test against several Flutter versions
flutter_channel: [stable, beta]

steps:
- uses: actions/checkout@v2

- run: .github/workflows/scripts/make-pana-pubspecs.sh

- uses: axel-op/dart-package-analyzer@v3
# Set an id for the current step, so we can reference it later
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
relativePath: packages/nhost_auth_dart

- name: Require analysis (near) perfection
env:
# "analysis" is the id set above
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
run: |
PERCENTAGE=$((( $TOTAL ) * 100 / ( $TOTAL_MAX - ${MAX_PANA_MISSING_POINTS:-10} )))
if (( $PERCENTAGE < 100 ))
then
echo "Score to low ($TOTAL/$TOTAL_MAX)."
exit 1
fi
- uses: actions/checkout@v2

- run: .github/workflows/scripts/make-pana-pubspecs.sh

- uses: axel-op/dart-package-analyzer@v3
# Set an id for the current step, so we can reference it later
id: analysis
with:
githubToken: ${{ github.token }}
relativePath: packages/nhost_auth_dart

- name: Require analysis (near) perfection
env:
# "analysis" is the id set above
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
run: |
PERCENTAGE=$((( $TOTAL ) * 100 / ( $TOTAL_MAX - ${MAX_PANA_MISSING_POINTS:-10} )))
if (( $PERCENTAGE < 100 ))
then
echo "Score to low ($TOTAL/$TOTAL_MAX)."
exit 1
fi
# Analyzes, checks formatting, and tests the packages
test-package:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# We test against several Flutter versions
flutter_channel: [stable, beta]

steps:
- uses: actions/checkout@v2

- name: Determine Flutter version
id: flutter-version
uses: shyndman/[email protected]
with:
channel: ${{ matrix.flutter_channel }}

- name: Cache Flutter dependencies
uses: actions/cache@v1
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ steps.flutter-version.outputs.version }}

# Setup the flutter environment
- name: Setup Dart/Flutter (specific channel)
uses: subosito/[email protected]
with:
channel: ${{ matrix.flutter_channel }}

# Get binary dependencies
- name: Install tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub get
dart pub global activate junitreport
dart pub global activate melos 2.9.0
- name: Bootstrap packages
run: melos bootstrap

# Run analysis on all packages
- name: Analyze packages
run: dart run melos analyze

# Run tests for package in question
- name: Execute tests
run: >
melos exec
--scope=nhost_auth_dart
--dir-exists=test --
'flutter test --no-pub --machine --coverage | tojunit
> test-results.xml'
# Report test results
- name: Report test results
uses: mikepenz/action-junit-report@v2
with:
check_name: 'Test results: nhost_auth_dart'
require_tests: false
report_paths: "packages/nhost_auth_dart/test-results.xml"
github_token: ${{ secrets.GITHUB_TOKEN }}

# Check if coverage was generated
- name: Check for coverage file
id: check_coverage_exists
uses: andstor/file-existence-action@v1
with:
files: "packages/nhost_auth_dart/coverage/lcov.info"

# Report coverage
- name: Report coverage
uses: zgosalvez/github-actions-report-lcov@v1
with:
artifact-name: 'Test coverage for nhost_auth_dart'
coverage-files: packages/nhost_auth_dart/coverage/lcov.info
working-directory: packages/nhost_auth_dart/
github-token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name != 'pull_request' && steps.check_coverage_exists.outputs.files_exists == 'true' }}
- uses: actions/checkout@v2

- name: Cache Flutter dependencies
uses: actions/cache@v1
with:
path: /opt/hostedtoolcache/flutter
key: ${{ runner.OS }}-flutter-install-cache-${{ steps.flutter-version.outputs.version }}

# Setup the flutter environment
- name: Setup Dart/Flutter (specific channel)
uses: subosito/flutter-action@v2
with:
flutter-version: "3.13.9"
channel: "stable"

# Get binary dependencies
- name: Install tools
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
dart pub get
dart pub global activate junitreport
dart pub global activate melos 3.2.0
- name: Bootstrap packages
run: melos bootstrap

# Run analysis on all packages
- name: Analyze packages
run: dart run melos analyze

# Run tests for package in question
- name: Execute tests
run: >
melos exec
--scope=nhost_auth_dart
--dir-exists=test --
'flutter test --no-pub --machine --coverage | tojunit
> test-results.xml'
# Report test results
- name: Report test results
uses: mikepenz/action-junit-report@v2
with:
check_name: "Test results: nhost_auth_dart"
require_tests: false
report_paths: "packages/nhost_auth_dart/test-results.xml"
github_token: ${{ github.token }}

# Check if coverage was generated
- name: Check for coverage file
id: check_coverage_exists
uses: andstor/file-existence-action@v1
with:
files: "packages/nhost_auth_dart/coverage/lcov.info"

# Report coverage
- name: Report coverage
uses: zgosalvez/github-actions-report-lcov@v1
with:
artifact-name: "Test coverage for nhost_auth_dart"
coverage-files: packages/nhost_auth_dart/coverage/lcov.info
working-directory: packages/nhost_auth_dart/
github-token: ${{ github.token }}
if: ${{ github.event_name != 'pull_request' && steps.check_coverage_exists.outputs.files_exists == 'true' }}
Loading

0 comments on commit 80a4a0f

Please sign in to comment.