lecture15_coverage.yml (2365B)
1 # This is a basic workflow to help you get started with Actions 2 # You find out more at: https://docs.github.com/en/actions 3 name: Lecture15 Continuous Integration Test Coverage 4 5 # Controls when the workflow will run 6 on: 7 # Triggers the workflow on push or pull request events but only for the master 8 # branch 9 push: 10 branches: 11 - main 12 pull_request: 13 branches: 14 - main 15 16 # Allows you to run this workflow manually from the Actions tab 17 workflow_dispatch: 18 19 # A workflow run is made up of one or more jobs that can run sequentially or in 20 # parallel. For more on jobs: 21 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobs 22 jobs: 23 # This workflow contains a single job called "test_coverage" 24 test_coverage: 25 26 # The type of runner that the job will run on 27 runs-on: ubuntu-latest 28 29 # Steps represent a sequence of tasks that will be executed as part of the 30 # job. For more on steps: 31 # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsteps 32 steps: 33 # Check out your repository under $GITHUB_WORKSPACE (job needs access to it) 34 # See: https://github.com/actions/checkout 35 - uses: actions/checkout@v3 36 37 # Enable Python environment in your CI container 38 # See: https://github.com/actions/setup-python 39 - uses: actions/setup-python@v3 40 with: 41 python-version: '3.10' # let's use a recent version 42 43 # Install Python dependencies 44 - name: Install dependencies 45 run: python -m pip install build pytest pytest-cov 46 47 # Build and install our package in the container 48 - name: Build and install the cs107_project in the container (using PEP517/518) 49 run: (python -m build --wheel && python -m pip install dist/*) 50 51 # Run the test coverage for the build 52 - name: Run tests and generate coverage html 53 run: (cd tests && ./run_tests.sh CI --cov=cs107_package --cov-report=html:htmlcov) 54 55 # Remove .gitignore file in test coverage data to be pushed to gh-pages 56 # branch 57 - name: Clean .gitignore in coverage output 58 run: rm -f tests/htmlcov/.gitignore 59 60 # Deploy to gh-pages branch 61 - name: Deploy test coverage GitHub page 62 uses: JamesIves/github-pages-deploy-action@v4 63 with: 64 folder: tests/htmlcov