This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
84 lines (80 loc) · 2.65 KB
/
test-reports.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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