Merge pull request #258 from ClimateImpactLab/dependabot/github_actio… #869
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
name: Test | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
codequality: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install flake8 black | |
- name: Test code quality | |
run: | | |
make format-check | |
container-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set image release tag | |
run: | | |
echo "docker_tag=dev" >> $GITHUB_ENV | |
- name: Set image name | |
run: | | |
echo "image_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ env.docker_tag }}" >> $GITHUB_ENV | |
- name: Build container | |
run: | | |
docker build . -t "${{ env.image_name }}" \ | |
--label "org.opencontainers.image.created=$(date --rfc-3339=ns)" \ | |
--label "org.opencontainers.image.version=${{ env.docker_tag }}" \ | |
--label "org.opencontainers.image.revision=${{ env.GITHUB_SHA }}" | |
- name: Test package | |
run: | | |
docker run -w /opt/dodola --name testcontainer "${{ env.image_name }}" \ | |
pytest -v --pyargs dodola --cov dodola --cov-report term-missing --cov-report xml | |
docker cp testcontainer:/opt/dodola/coverage.xml ./coverage.xml | |
- name: Test CLI | |
run: | | |
docker run "${{ env.image_name }}" dodola --help | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |