solution: initial Github actions #1
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| - ci/* | |
| pull_request: | |
| branches: | |
| - master | |
| - release/* | |
| - ci/* | |
| jobs: | |
| unit-test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Analyze | |
| run: dart analyze --fatal-infos | |
| - name: Run unit tests | |
| run: dart test --exclude-tags=integration | |
| # Validates pubspec / package layout / generated stub structure | |
| # so we don't discover packaging bugs only at release time. | |
| - name: Validate package | |
| run: dart pub publish --dry-run | |
| # Hits the staging API. Skipped on PRs from forks (no access to secrets). | |
| integration-test: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: unit-test | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Connect Tailscale | |
| uses: tailscale/github-action@v2 | |
| with: | |
| oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | |
| oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | |
| tags: tag:ci | |
| - name: Run integration tests | |
| run: dart test --tags=integration | |
| env: | |
| EMERALD_API_TOKEN: ${{ secrets.EMERALD_API_TOKEN }} |