test.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Github-Action-Test
  2. # 一次只运行一个job
  3. concurrency:
  4. group: ${{ github.workflow }}-${{ github.ref }}
  5. cancel-in-progress: true
  6. on:
  7. push:
  8. branches: [master]
  9. tags:
  10. - v*
  11. # v1.2.1
  12. on:
  13. pull_request:
  14. # 新建一个PR时
  15. types: [create, synchronize, update]
  16. #
  17. branches: [feature/**]
  18. #
  19. paths:
  20. - ".github/workflows/test.yaml"
  21. - "src/api"
  22. on:
  23. schedule:
  24. # 每天凌晨 8:30 执行
  25. cron: "30 8 * * *"
  26. jobs:
  27. # 构建名称
  28. build:
  29. runs-on: ubuntu-latest
  30. with:
  31. working_directory: flutter_news_example/api
  32. analyze_directories: "routes lib test"
  33. coverage_excludes: "**/*.g.dart"
  34. report_on: "routes,lib"
  35. steps:
  36. - uses: actions/checkout@v4
  37. # 输出环境变量
  38. - run: echo $CI
  39. - run: echo $GITHUB_REPOSITORY
  40. - run: echo $GITHUB_EVENT_NAME
  41. - run: echo $GITHUB_SHA
  42. - run: echo $GITHUB_REF_NAME
  43. - run: echo $GITHUB_HEAD_REF
  44. - name: Dump GitHub context
  45. run: echo '${{ toJSON(github) }}'
  46. - name: Delete Workflow Runs
  47. uses: Mattraks/delete-workflow-runs@main
  48. with:
  49. retain_days: 90
  50. keep_minimum_runs: 6