-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Actions CI for backend and frontend #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||||||||||||||||||
| name: CI | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| on: | ||||||||||||||||||||||
| push: | ||||||||||||||||||||||
| branches: ["**"] | ||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||
| branches: ["**"] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||
| backend: | ||||||||||||||||||||||
| name: Backend (Python) | ||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||
| steps: | ||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Set up Python 3.12 | ||||||||||||||||||||||
| uses: actions/setup-python@v5 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| python-version: "3.12" | ||||||||||||||||||||||
| cache: "pip" | ||||||||||||||||||||||
| cache-dependency-path: backend/requirements.txt | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||
| working-directory: backend | ||||||||||||||||||||||
| run: pip install -r requirements.txt | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Compile backend | ||||||||||||||||||||||
| working-directory: backend | ||||||||||||||||||||||
| run: python -m py_compile main.py mavlink_adapter.py dji_adapter.py | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Run tests (if present) | ||||||||||||||||||||||
| working-directory: backend | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| if [ -f pytest.ini ] || [ -d tests ]; then | ||||||||||||||||||||||
| pip install pytest | ||||||||||||||||||||||
| pytest | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| echo "No tests found, skipping." | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| frontend: | ||||||||||||||||||||||
| name: Frontend (Node) | ||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||
| steps: | ||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Set up Node 20 | ||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| node-version: "20" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Cache node_modules | ||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| path: skydash/frontend/node_modules | ||||||||||||||||||||||
| key: ${{ runner.os }}-node-${{ hashFiles('skydash/frontend/package-lock.json', 'skydash/frontend/package.json') }} | ||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||
| ${{ runner.os }}-node- | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
+54
to
+62
|
||||||||||||||||||||||
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: skydash/frontend/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('skydash/frontend/package-lock.json', 'skydash/frontend/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| cache: npm | |
| cache-dependency-path: skydash/frontend/package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache key includes 'package-lock.json', but this file does not exist in the repository. The cache key will fail to generate a hash for the missing file. Consider either generating a package-lock.json file by running 'npm install' locally and committing it, or update the cache key to only use 'package.json'. Using package-lock.json is recommended for reproducible builds.