-
Notifications
You must be signed in to change notification settings - Fork 24
138 lines (121 loc) · 3.8 KB
/
_Test-OCI-Factory.yaml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: _Test OCI Factory | mock-rock
on:
workflow_dispatch:
push:
paths:
- ".github/workflows/*"
- ".github/actions/**"
- "!.github/workflows/CLA-Check.yaml"
- "!.github/workflows/PR-Validator.yaml"
- "!.github/workflows/_Auto-updates.yaml"
- "!.github/workflows/Continuous-Testing.yaml"
- "!.github/workflows/CLI-Client.yaml"
- "examples/**"
- "oci/mock*"
- "src/**"
- "tools/**"
- "tests/**"
- "!tools/workflow-engine/**"
- "!tools/cli-client/**"
env:
# local path to clone the oci-factory to
# path of pytest junit output
PYTEST_RESULT_PATH: pytest_results.xml
jobs:
access-check:
name: Validate access to mock-rock
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/validate-actor
with:
admin-only: true
image-path: "oci/mock-rock"
github-token: ${{ secrets.ROCKSBOT_TOKEN }}
pytest:
# Trigger python unit tests across the repository
name: pytest
runs-on: ubuntu-22.04
steps:
# Job Setup
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: "3.x"
# Note: Add additional dependency installation lines as required below
# test-oci-factory/pytest requirements
- run: pip install -r tests/etc/requirements.txt
# build_rock/configure requirements
- run: pip install -r src/build_rock/configure/requirements.txt
- name: Run pytest
continue-on-error: true
run: |
python3 -m pytest --junit-xml "${{ env.PYTEST_RESULT_PATH }}"
- name: Generate Summary
if: ${{ !cancelled() }}
run: |
python3 -m tools.junit_to_markdown --input-junit "${{ env.PYTEST_RESULT_PATH }}" >> $GITHUB_STEP_SUMMARY
- name: Upload pytest Result
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.PYTEST_RESULT_PATH }}
path: ${{ env.PYTEST_RESULT_PATH }}
if-no-files-found: error
bats-test:
# Trigger bash unit tests across the repository
name: bats
runs-on: ubuntu-22.04
steps:
# Job Setup
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install bats
run: |
sudo apt-get update
sudo apt-get install -y bats
- name: Run bats
env:
GITHUB_TOKEN: ${{ secrets.ROCKSBOT_TOKEN }}
run: |
find ${{ github.workspace }} -name 'test-*.bats' | xargs bats
# # Test use case of reuseable workflow
# build-rock:
# uses: ./.github/workflows/Build-Rock.yaml
# with:
# # mock rock
# oci-archive-name: "mock-rock"
# rock-repo: canonical/rocks-toolbox
# rock-repo-commit: main
# rockfile-directory: mock_rock/1.2 # 1.0 - multi arch, 1.2 single arch rock
# test-rock:
# uses: ./.github/workflows/Test-Rock.yaml
# needs: [build-rock]
# with:
# oci-archive-name: "mock-rock"
# test-black-box: true
# test-efficiency: true
# test-malware: true
# test-oci-compliance: true
# test-vulnerabilities: true
# # Test workflow used in continuous testing
# test-vulnerability-scan:
# name: Test vulnerability scan workflow
# needs: [access-check]
# uses: ./.github/workflows/Vulnerability-Scan.yaml
# with:
# oci-image-name: "ghcr.io/canonical/oci-factory/mock-rock:1.1-22.04_844"
# oci-image-path: "oci/mock-rock"
# secrets: inherit
# Test full image workflow
test-workflows:
name: Trigger internal tests for mock-rock
needs: [access-check]
uses: ./.github/workflows/Image.yaml
with:
oci-image-name: "mock-rock"
upload: true
secrets: inherit