diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..59d17182 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,79 @@ +name: Build & Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + # Installing Flutter because it's easier to generate .lcov files for test coverage + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + - name: Install dependencies + run: flutter pub get + + - name: Flutter analyze + run: flutter analyze + + # Your project will need to have tests in test/ and a dependency on + # package:test for this step to succeed. Note that Flutter projects will + # want to change this to 'flutter test'. + - name: Run tests + run: flutter test --coverage + + - uses: codecov/codecov-action@v3 + with: + files: coverage/lcov.info + verbose: true # optional (default = false) + + + # Continuous Deployment to Fly.io + # https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ + # flutter_deploy: + # name: Deploy Flutter app + # runs-on: ubuntu-latest +# + # needs: [build] + # # https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions + # if: github.ref == 'refs/heads/main' + # env: + # FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + # steps: + # - uses: actions/checkout@v3 +# + # - name: Install Flutter + # uses: subosito/flutter-action@v2 + # with: + # channel: 'stable' +# + # # Your project will need to have tests in test/ and a dependency on + # # package:test for this step to succeed. Note that Flutter projects will + # # want to change this to 'flutter test'. + # - name: Check build + # run: flutter analyze +# + # - name: Create release build + # # github.com/dwyl/app/issues/315#issuecomment-1443747737 + # run: flutter build web --release --web-renderer html + # +# + # # See https://github.com/dwyl/app/issues/326. + # # This will fetch files concurrently needed for the app and not wait for `flutter.js` to load + # - name: Run post-build script to download files concurrently + # run: | + # chmod +x ./build_tools/patch_web.sh + # sh ./build_tools/patch_web.sh --ignore-whitespace +# + # - uses: superfly/flyctl-actions@1.1 + # with: + # args: "deploy" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ed8021b2..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: build - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v3 - - # Installing Flutter because it's easier to generate .lcov files for test coverage - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - - - name: Install dependencies - run: flutter pub get - - - name: Flutter analyze - run: flutter analyze - - # Your project will need to have tests in test/ and a dependency on - # package:test for this step to succeed. Note that Flutter projects will - # want to change this to 'flutter test'. - - name: Run tests - run: flutter test --coverage - - - uses: codecov/codecov-action@v3 - with: - files: coverage/lcov.info - verbose: true # optional (default = false) - - - # Continuous Deployment to Fly.io - # https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ - flutter_deploy: - name: Deploy Flutter app - runs-on: ubuntu-latest - - needs: [build] - # https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions - if: github.ref == 'refs/heads/main' - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} - steps: - - uses: actions/checkout@v3 - - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - - # Your project will need to have tests in test/ and a dependency on - # package:test for this step to succeed. Note that Flutter projects will - # want to change this to 'flutter test'. - - name: Check build - run: flutter analyze - - - name: Create release build - # github.com/dwyl/app/issues/315#issuecomment-1443747737 - run: flutter build web --release --web-renderer html - - - # See https://github.com/dwyl/app/issues/326. - # This will fetch files concurrently needed for the app and not wait for `flutter.js` to load - - name: Run post-build script to download files concurrently - run: | - chmod +x ./build_tools/patch_web.sh - sh ./build_tools/patch_web.sh --ignore-whitespace - - - uses: superfly/flyctl-actions@1.1 - with: - args: "deploy" \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy_web.yml similarity index 96% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy_web.yml index 49b31a3d..d7d774f9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy_web.yml @@ -1,4 +1,4 @@ -name: Deploy to Github Pages +name: Deploy Web (GitHub Pages) on: push: branches: [ main ] diff --git a/build_tools/web/flutter_service_worker.js.patch b/build_tools/web/flutter_service_worker.js.patch index 3f37e8d8..d4d82579 100644 --- a/build_tools/web/flutter_service_worker.js.patch +++ b/build_tools/web/flutter_service_worker.js.patch @@ -1,17 +1,17 @@ Patched flutter_service_worker.js splits up the loading of files so they are parallel. see: https://github.com/dwyl/app/issues/326#issuecomment-1478314967 ---- flutter_service_worker.js 2023-03-24 19:00:29 -+++ flutter_service_worker2.js 2023-03-24 19:04:42 -@@ -28,22 +28,11 @@ - +--- flutter_service_worker.js 2023-10-18 11:49:35 ++++ flutter_service_worker_new.js 2023-10-18 11:56:09 +@@ -55,21 +55,9 @@ + "canvaskit/skwasm.worker.js": "51253d3321b11ddb8d73fa8aa87d3b15"}; // The application shell files that are downloaded before a service worker can // start. --const CORE = [ -- "main.dart.js", +-const CORE = ["main.dart.js", -"index.html", -"assets/AssetManifest.json", -"assets/FontManifest.json"]; + -// During install, the TEMP cache is populated with the application shell files. -self.addEventListener("install", (event) => { - self.skipWaiting();