Skip to content

Commit

Permalink
add github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MacHu-GWU committed Mar 24, 2023
1 parent 4207808 commit 6e2948c
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# comprehensive github action yml reference: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions

---
name: CI

on:
push: # any push event to master will trigger this
branches: ["main"]
pull_request: # any pull request to master will trigger this
branches: ["main"]
workflow_dispatch: # allows you to manually trigger run

jobs:
tests:
name: "${{ matrix.os }} Python ${{ matrix.python-version }}"
runs-on: "${{ matrix.os }}" # for all available VM runtime, see this: https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
env: # define environment variables
USING_COVERAGE: "3.7,3.8,3.9,3.10"
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
# os: ["ubuntu-latest", ] # for debug only
# python-version: ["3.6", ] # for debug only
steps:
- uses: "actions/checkout@v3" # https://github.com/marketplace/actions/checkout
- uses: "actions/setup-python@v3" # https://github.com/marketplace/actions/setup-python
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies on MacOS or Linux"
if: matrix.os == 'ubuntu-latest' # for condition steps, you should put if at begin, and use single quote for logical expression
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel virtualenv codecov
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-test.txt
pip install .
- name: "Install dependencies on Windows"
if: matrix.os == 'windows-latest'
run: |
python -m site
python -m pip install --upgrade pip setuptools wheel virtualenv codecov
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-test.txt
pip install .
- name: "Run pytest"
env:
AWS_ACCESS_KEY_ID_FOR_GITHUB_CI: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_GITHUB_CI }}
AWS_SECRET_ACCESS_KEY_FOR_GITHUB_CI: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_GITHUB_CI }}
run: "python -m pytest tests --cov=boto_session_manager"
- name: "Upload coverage to Codecov"
if: "contains(env.USING_COVERAGE, matrix.python-version)"
uses: "codecov/codecov-action@v2" # https://github.com/marketplace/actions/codecov-action
with:
fail_ci_if_error: true

0 comments on commit 6e2948c

Please sign in to comment.