This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
Merge pull request #338 from credo-ai/new_logo #63
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 Reports | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
paths-ignore: | |
- '**.md' | |
- '**.rst' | |
- '**.ipynb' | |
env: | |
TEST_REPORTS_BUCKET_NAME: "credoai-cicd-public-artifacts" | |
AWS_REGION: "us-west-2" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
run-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: GitHub Slug Action | |
uses: rlespinasse/[email protected] | |
with: | |
prefix: CI_ | |
- name: Install AWS CLI | |
id: install-aws-cli | |
uses: unfor19/[email protected] | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
cache-dependency-path: 'requirements*.txt' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest-cov genbadge | |
pip install tensorflow | |
pip install -r requirements.txt | |
pip install -r requirements-extras.txt | |
pip install -r requirements-dev.txt | |
- name: Run tests | |
env: | |
CREDOAI_LENS_CONFIG_JSON_B64: ${{ secrets.CREDOAI_LENS_CONFIG_JSON_B64 }} | |
CREDOAI_LENS_PLAN_URL: ${{ secrets.CREDOAI_LENS_PLAN_URL }} | |
run: | | |
rm -rf test-reports/ | |
scripts/test-reports.sh | |
- name: Configure AWS Credentials | |
id: aws-creds | |
if: always() | |
# continue-on-error: true # Set this if you don't want the workflow to error on AWS creds issue | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::858725184704:role/allow-gh-actions-public | |
role-session-name: credoai-lens-test-reports | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Push reports to S3 | |
if: steps.aws-creds.outcome == 'success' | |
run: | | |
if [ -e "test-reports/cov.xml" ]; then | |
genbadge coverage -i test-reports/cov.xml -o test-reports/coverage-badge.svg | |
fi | |
if [ -e "junit.xml" ]; then | |
genbadge tests -i junit.xml -o test-reports/tests-badge.svg | |
cp junit.xml test-reports/ | |
fi | |
if [ -d "test-reports" ]; then | |
tar czf test-reports.tgz test-reports | |
aws s3 sync test-reports s3://${{ env.TEST_REPORTS_BUCKET_NAME }}/$CI_GITHUB_REPOSITORY_NAME_PART_SLUG/$CI_GITHUB_REF_SLUG/ | |
fi | |
- name: test-reports artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: ./test-reports.tgz |