Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches:
- main
- master
pull_request:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that you have main and master for push, but shouldn't you also limit in the pull request? To not build on every PR?


jobs:
ci:
runs-on: ubuntu-latest

defaults:
run:
working-directory: task-1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good approach. Make easier than repeat on every step.


steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: task-1/package-lock.json

- name: Install dependencies
run: npm install

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a github action, the ideal is to use npm ci instead of the npm install


- name: Run linter
run: npm run lint

- name: Run unit tests
run: npm test -- --run

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the -- --run instead of only the npm test?


- name: Build app
run: npm run build

- name: Zip dist folder
run: zip -r dist.zip dist

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: weather-app-dist
path: task-1/dist.zip
if-no-files-found: error
86 changes: 20 additions & 66 deletions task-1/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion task-1/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ interface Props {

export function SearchBar({ onSearch, loading }: Props) {
const [value, setValue] = useState("");
const unusedConstMaybeDeleteMe = "Search";

const handleSubmit = (e: FormEvent) => {
e.preventDefault();
Expand Down