Use local httpbun for tests in CI #918
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Verify packages abilities | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- '6.0.0' | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
branches: | |
- main | |
- '6.0.0' | |
paths-ignore: | |
- "**.md" | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} | |
jobs: | |
workflows: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
sdk: [ min, stable, beta ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/[email protected] | |
with: | |
cache: true | |
flutter-version: ${{ matrix.sdk == 'min' && '2.8.0' || '' }} | |
channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }} | |
- run: | | |
chmod +x ./scripts/prepare_pinning_certs.sh | |
./scripts/prepare_pinning_certs.sh | |
- name: Install proxy and mkcert for tests | |
run: sudo apt-get update && sudo apt-get install -y squid mkcert libnss3-tools | |
- run: dart pub get | |
- uses: bluefireteam/melos-action@v2 | |
with: | |
run-bootstrap: false | |
- name: Patching files for Flutter ${{ matrix.sdk }} | |
run: dart ./scripts/files_patch.dart | |
- name: Check satisfied packages | |
run: | | |
dart ./scripts/melos_ignored_packages.dart | |
echo $(cat .melos_ignored_packages) >> ~/.bash_profile | |
- name: Bootstrap | |
run: melos bootstrap $(eval echo $IGNORED_PACKAGES) | |
- name: Start local httpbun | |
run: | | |
mkcert -install | |
mkcert -cert-file '/tmp/cert.pem' -key-file '/tmp/key.pem' httpbun.local | |
echo '127.0.0.1 httpbun.local' | sudo tee --append /etc/hosts | |
docker run \ | |
--name httpbun \ | |
--detach \ | |
--publish 443:443 \ | |
--volume /tmp:/tmp:ro \ | |
--env HTTPBUN_TLS_CERT=/tmp/cert.pem \ | |
--env HTTPBUN_TLS_KEY=/tmp/key.pem \ | |
--pull always \ | |
sharat87/httpbun | |
sleep 1 | |
curl --fail --silent --show-error https://httpbun.local/any | |
- name: '[Verify step] Format' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) -- "dart format --set-exit-if-changed ." | |
- name: '[Verify step] Analyze Dart packages' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --no-flutter -- "dart analyze --fatal-infos" | |
- name: '[Verify step] Analyze Flutter packages' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --flutter -- "flutter analyze --fatal-infos" | |
- name: '[Verify step] Publish dry-run' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" -- "dart pub publish --dry-run" | |
- name: '[Verify step] Test Dart packages [VM]' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --no-flutter -- "MELOS_ROOT_PATH/scripts/dart_test.sh --platform=vm" | |
- name: '[Verify step] Test Dart packages [Chrome]' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --no-flutter -- "MELOS_ROOT_PATH/scripts/dart_test.sh --platform=chrome" | |
- name: '[Verify step] Test Dart packages [Firefox]' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --no-flutter -- "MELOS_ROOT_PATH/scripts/dart_test.sh --platform=firefox" | |
- name: '[Verify step] Test Flutter packages' | |
run: melos exec $(eval echo $IGNORED_PACKAGES) --ignore="*example*" --flutter -- "flutter test" |