Skip to content

Commit 0cee2c1

Browse files
Initial commit
0 parents  commit 0cee2c1

35 files changed

+81676
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @arm/arm-model-explorer
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Bug Report
3+
about: Report issue (excl. security; see SECURITY.md)
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
<!-- Provide a clear and concise description of the bug -->
11+
12+
## Steps to Reproduce
13+
1.
14+
2.
15+
3.
16+
<!-- Add more steps as needed -->
17+
18+
## Expected Behavior
19+
<!-- Describe what you expected to happen -->
20+
21+
## Actual Behavior
22+
<!-- Describe what actually happened -->
23+
24+
## Screenshots
25+
<!-- If applicable, add screenshots to help explain your problem -->
26+
27+
## Environment
28+
<!-- Add any other relevant environment details -->
29+
- Model Explorer Version: [e.g., 1.2.3]
30+
- Adapter Version: [e.g., 1.2.3]
31+
- OS: [e.g., Windows 10, macOS 12.0]
32+
33+
## Additional Context
34+
<!-- Add any other context about the problem here -->
35+
36+
## Possible Solution (Optional)
37+
<!-- If you have suggestions on how to fix the bug, add them here -->
38+
39+
## Logs/Error Messages
40+
<!-- Include any relevant log entries or error messages -->
41+
42+
- [ ] I have searched for existing bug reports
43+
- [ ] I have included all relevant information

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
blank_issues_enabled: false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or enhancement
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Feature Description
10+
<!-- Provide a clear and concise description of the feature you'd like to see implemented -->
11+
12+
## Problem Statement
13+
<!-- Describe the problem this feature would solve or the need it addresses -->
14+
15+
## Proposed Solution
16+
<!-- Describe how you envision this feature working -->
17+
18+
## Alternative Solutions
19+
<!-- Describe any alternative solutions or features you've considered -->
20+
21+
## Additional Context
22+
<!-- Add any other context, screenshots, or examples about the feature request here -->
23+
24+
- [ ] I have searched for existing feature requests

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
timezone: Europe/London
8+
open-pull-requests-limit: 10
9+
rebase-strategy: disabled

.github/workflows/check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint and Format
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
7+
jobs:
8+
lint-and-format:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12+
- name: Install ruff
13+
run: |
14+
python -m pip install .[format]
15+
- name: Check ruff lint
16+
run: |
17+
ruff check .
18+
- name: Check ruff format
19+
run: |
20+
ruff format --check .

.github/workflows/ci.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: TOSA Adapter for Model Explorer CI
2+
on:
3+
push:
4+
branches: ["main"]
5+
tags:
6+
- "v*.*.*"
7+
pull_request:
8+
branches: ["main"]
9+
workflow_dispatch:
10+
env:
11+
BUILD_PYTHON_VERSION: "3.12"
12+
ME_REPO_ACCESS_APP_ID: ${{ secrets.ME_REPO_ACCESS_APP_ID }}
13+
ME_REPO_ACCESS_PRIVATE_KEY: ${{ secrets.ME_REPO_ACCESS_PRIVATE_KEY }}
14+
15+
jobs:
16+
test:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.12", "3.11", "3.10"]
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Set up Python environment
24+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Checkout plugin repo
29+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
30+
with:
31+
path: tosa-adapter-model-explorer
32+
33+
- name: Install plugin Python packages
34+
run: |
35+
cd tosa-adapter-model-explorer
36+
python -m venv .venv
37+
source .venv/bin/activate
38+
python -m pip install .[test]
39+
40+
- name: Run plugin tests
41+
run: |
42+
cd tosa-adapter-model-explorer
43+
source .venv/bin/activate
44+
pytest --tb=short -v
45+
46+
build:
47+
needs: test
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Set up Python environment
51+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
52+
with:
53+
python-version: ${{ env.BUILD_PYTHON_VERSION }}
54+
55+
- name: Checkout plugin repo
56+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
with:
58+
path: tosa-adapter-model-explorer
59+
60+
- name: Install plugin Python packages
61+
run: |
62+
cd tosa-adapter-model-explorer
63+
python -m venv .venv
64+
source .venv/bin/activate
65+
python -m pip install .[build]
66+
67+
- name: Build plugin package
68+
run: |
69+
cd tosa-adapter-model-explorer
70+
source .venv/bin/activate
71+
python -m build
72+
73+
- name: Upload plugin package artifact
74+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
75+
with:
76+
name: dist
77+
path: tosa-adapter-model-explorer/dist
78+
79+
release:
80+
name: Release
81+
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'arm'
82+
needs:
83+
- build
84+
runs-on: ubuntu-latest
85+
environment:
86+
name: pypi
87+
url: https://pypi.org/p/tosa-adapter-model-explorer
88+
permissions:
89+
id-token: write
90+
91+
steps:
92+
- uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc #v3.0.0
93+
id: get_app_token
94+
with:
95+
app_id: ${{ env.ME_REPO_ACCESS_APP_ID }}
96+
private_key: ${{ env.ME_REPO_ACCESS_PRIVATE_KEY }}
97+
98+
- uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0
101+
token: ${{ steps.get_app_token.outputs.token }}
102+
103+
- name: Generate release notes
104+
uses: orhun/git-cliff-action@4a4a951bc43fafe41cd2348d181853f52356bee7 # v4.4.2
105+
id: git-cliff
106+
with:
107+
config: cliff.toml
108+
args: --latest
109+
env:
110+
OUTPUT: CHANGELOG.md
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
GITHUB_REPO: ${{ github.repository }}
113+
114+
- name: Download all artifacts
115+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
116+
with:
117+
path: dist/
118+
merge-multiple: true
119+
120+
- name: Publish distribution to PyPI
121+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1.12.4
122+
123+
- name: Publish GitHub release
124+
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
125+
with:
126+
tag_name: ${{ github.ref_name }}
127+
name: ${{ github.ref_name }}
128+
body_path: CHANGELOG.md
129+
token: ${{ steps.get_app_token.outputs.token }}
130+
131+
sync-commits-to-public-repo:
132+
name: Sync commits to public repo
133+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner != 'arm'
134+
needs: build
135+
runs-on: ubuntu-latest
136+
steps:
137+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
138+
with:
139+
fetch-depth: 0
140+
- name: Checkout target repository
141+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
142+
with:
143+
repository: arm/tosa-adapter-model-explorer
144+
token: ${{ secrets.ARM_ORG_TOKEN }}
145+
path: target-repo
146+
- name: Push commits to public repo
147+
run: |
148+
cd target-repo
149+
git remote add source ${{ github.server_url }}/${{ github.repository }}
150+
git fetch source main
151+
git checkout main
152+
git merge source/main
153+
git push origin main
154+
155+
sync-release-tags-to-public-repo:
156+
name: Sync release tags to public repo
157+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && github.repository_owner != 'arm'
158+
runs-on: ubuntu-latest
159+
steps:
160+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
161+
with:
162+
fetch-depth: 0
163+
- name: Checkout target repository
164+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
165+
with:
166+
repository: arm/tosa-adapter-model-explorer
167+
token: ${{ secrets.ARM_ORG_TOKEN }}
168+
path: target-repo
169+
- name: Push tags to public repo
170+
run: |
171+
cd target-repo
172+
git remote add source ${{ github.server_url }}/${{ github.repository }}
173+
git fetch source --tags
174+
git push origin ${{ github.ref_name }}

.github/workflows/pr.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
validate-title:
16+
if: github.actor != 'dependabot[bot]'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
20+
with:
21+
subjectPattern: ^(?![A-Z]).+$
22+
subjectPatternError: 'PR title must not start with a capital letter. Got: "${subject}"'
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Trigger Release
2+
3+
# Release flow:
4+
# - Run *this* workflow from the internal repository.
5+
# - This will create and push a version bump commit and tag it.
6+
# - ci.yml's sync job will trigger and sync both the commit and tag to the external repository.
7+
# - The tag push will trigger the external repository's release job.
8+
9+
on:
10+
workflow_dispatch:
11+
12+
jobs:
13+
tag-new-release:
14+
if: github.repository_owner != 'arm'
15+
runs-on: ubuntu-latest
16+
steps:
17+
# We want our tag push at the end to trigger a workflow. We can't do that using repository's GITHUB_TOKEN.
18+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/triggering-a-workflow#triggering-a-workflow-from-a-workflow
19+
- uses: getsentry/action-github-app-token@d4b5da6c5e37703f8c3b3e43abb5705b46e159cc # v3.0.0
20+
id: get_app_token
21+
with:
22+
app_id: ${{ secrets.ME_REPO_ACCESS_APP_ID }}
23+
private_key: ${{ secrets.ME_REPO_ACCESS_PRIVATE_KEY }}
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
token: ${{ steps.get_app_token.outputs.token }}
29+
- name: Set git config for ML Repo bot
30+
run: |
31+
git config --global user.email "1736931+model-explorer-plugins-repo-access[bot]@users.noreply.github.com"
32+
git config --global user.name "model-explorer-plugins-repo-access[bot]"
33+
- name: Calculate new version
34+
uses: orhun/git-cliff-action@4a4a951bc43fafe41cd2348d181853f52356bee7 # v4.4.2
35+
id: git-cliff
36+
with:
37+
config: cliff.toml
38+
args: --bump --no-exec --github-repo ${{ github.repository }}
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Check if there's anything to release
42+
run: |
43+
BUMPED_TAG=${{ steps.git-cliff.outputs.version }}
44+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.0')
45+
if [[ "$BUMPED_TAG" == "null" || -z "$BUMPED_TAG" ]]; then
46+
exit 1
47+
fi
48+
if [[ "$BUMPED_TAG" == "$LATEST_TAG" ]]; then
49+
echo "Bumped tag is the same as latest: $BUMPED_TAG. Nothing to release."
50+
exit 1
51+
fi
52+
- name: Trim the v from version tag
53+
id: strip-v-from-version-tag
54+
run: |
55+
RELEASE_VERSION=${{ steps.git-cliff.outputs.version }}
56+
RELEASE_VERSION_WITHOUT_V="${RELEASE_VERSION#v}"
57+
echo "version=$RELEASE_VERSION_WITHOUT_V" >> "$GITHUB_OUTPUT"
58+
- name: Update pyproject version
59+
run: |
60+
VERSION=${{ steps.strip-v-from-version-tag.outputs.version }}
61+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
62+
git add pyproject.toml
63+
git commit -m "Update pyproject version to v$VERSION"
64+
git push
65+
- name: Tag new release
66+
run: |
67+
VERSION=${{ steps.git-cliff.outputs.version }}
68+
git tag $VERSION
69+
git push origin tag $VERSION

0 commit comments

Comments
 (0)