Created
October 31, 2019 16:39
-
-
Save Surgo/8fa6e1404b9e13b4f02dab246d0e6927 to your computer and use it in GitHub Desktop.
Cache Python packages with virtual environments
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
# .github/workflows/continuous-integration.yml | |
--- | |
name: Continuous Integration | |
on: | |
push: | |
schedule: | |
- cron: "0 */4 * * *" # At minute 0 past every 4th hour | |
jobs: | |
static_analysis_python: | |
name: Static analysis for Python codes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: Cache Python packages | |
uses: actions/cache@preview | |
with: | |
path: .venv | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
python -m pip install -r requirements.txt | |
- name: Run static analysis tools | |
run: | | |
source .venv/bin/activate | |
flake8 --verbose --jobs=auto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment