Skip to content

Commit 47079f2

Browse files
authored
Add tags to filter tests (#87)
* Helpers tag is OK * Add daily tag * Exceptions tag * Export tag * Add hourly tag * Add tags for plots * Use nworkers for filtered tests * Add tag info for future ref. * Bump patch version * Remove v1.8 from CI * Update actions to latest release * Use macOS latest * Use julia-actions/cache
1 parent df68bb2 commit 47079f2

13 files changed

Lines changed: 60 additions & 53 deletions

.github/workflows/CI.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88

99
workflow_dispatch:
1010

11+
permissions:
12+
actions: write
13+
contents: read
14+
1115
jobs:
1216
test:
1317
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -18,32 +22,22 @@ jobs:
1822
version:
1923
- '1.10'
2024
- '1.9'
21-
- '1.8'
2225
os:
2326
- ubuntu-latest
24-
- macos-14
27+
- macos-latest
2528
- windows-latest
2629
arch:
2730
- x64
2831
steps:
29-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
3033
- uses: julia-actions/setup-julia@latest
3134
with:
3235
version: ${{ matrix.version }}
3336
arch: ${{ matrix.arch }}
34-
- uses: actions/cache@v1
35-
env:
36-
cache-name: cache-artifacts
37-
with:
38-
path: ~/.julia/artifacts
39-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
40-
restore-keys: |
41-
${{ runner.os }}-test-${{ env.cache-name }}-
42-
${{ runner.os }}-test-
43-
${{ runner.os }}-
37+
- uses: julia-actions/cache@v1
4438
- uses: julia-actions/julia-buildpkg@latest
4539
- uses: julia-actions/julia-runtest@latest
4640
- uses: julia-actions/julia-processcoverage@latest
47-
- uses: codecov/codecov-action@v3
41+
- uses: codecov/codecov-action@v4
4842
with:
4943
file: lcov.info

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "WeatherReport"
22
uuid = "3c954167-71e4-4212-9688-830d6b8fcbc2"
33
authors = ["Vikas Negi <vikas.negi10@gmail.com>"]
4-
version = "0.21.0"
4+
version = "0.21.1"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

test/daily_test.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testitem "Check if current weather conditions are available" begin
1+
@testitem "Check if current weather conditions are available" tags = [:daily] begin
22

33
input = WeatherReport.CityInput("Tokyo", "current", 1)
44
current_dict = WeatherReport.get_forecast(input)
@@ -11,7 +11,7 @@
1111

1212
end
1313

14-
@testitem "Check if daily weather conditions are available" begin
14+
@testitem "Check if daily weather conditions are available" tags = [:daily] begin
1515

1616
input = WeatherReport.CityInput("Madrid", "daily", 2)
1717
daily_dict = WeatherReport.get_forecast(input)

test/exceptions_test.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
@testitem "Check if expected error appears when city is not found" begin
1+
@testitem "Expected error appears when city is not found" tags = [:exceptions] begin
22

33
@test_throws ErrorException("Coordinates for city not found!") plot_hourly_temp("EEdinhoven")
44

55
end
66

7-
@testitem "Check if expected error appears when path is invalid" begin
7+
@testitem "Expected error appears when path is invalid" tags = [:exceptions] begin
88

99
# Incorrect path
1010
invalid_path = joinpath(@__DIR__,
@@ -16,7 +16,7 @@ end
1616

1717
end
1818

19-
@testitem "Check if expected error appears when unknown forecast type is used" begin
19+
@testitem "Expected error appears when unknown forecast type is used" tags = [:exceptions] begin
2020

2121
# Not supported
2222
forecast_type = "tempest"
@@ -25,7 +25,7 @@ end
2525

2626
end
2727

28-
@testitem "Check if expected error appears when end date is before start date" begin
28+
@testitem "Expected error appears when end date is before start date" tags = [:exceptions] begin
2929

3030
@test_throws AssertionError("End date cannot be before start date!") plot_hist_temp("Veldhoven", start_date = "2000-03-01", end_date = "2000-01-01")
3131

test/export_history_test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
df_temp = DBInterface.execute(db, "SELECT * FROM temperature_2m") |> DataFrame
2525
end
2626

27-
@testitem "SQLite database" setup = [TestDatabase] begin
27+
@testitem "SQLite database" setup = [TestDatabase] tags = [:export] begin
2828

2929
using SQLite
3030

test/helpers_test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testitem "Check if cities database is available" begin
1+
@testitem "Check if cities database is available" tags = [:helpers] begin
22

33
path = joinpath(@__DIR__,
44
"..",
@@ -13,14 +13,14 @@
1313

1414
end
1515

16-
@testitem "Verify if closest match for an incorrect city name is found" begin
16+
@testitem "Verify if closest match for an incorrect city name is found" tags = [:helpers] begin
1717

1818
@test WeatherReport.closest_match("Halwani")[1] == "Haldwani"
1919
@test WeatherReport.closest_match("amsteldam")[1] == "Amsterdam"
2020

2121
end
2222

23-
@testitem "Verify if location preference is set correctly" begin
23+
@testitem "Verify if location preference is set correctly" tags = [:helpers] begin
2424

2525
set_city("Haldwani")
2626
@test WeatherReport.get_city() == "Haldwani"

test/hourly_test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testitem "Check if hourly temperature forecast is available" begin
1+
@testitem "Check if hourly temperature forecast is available" tags = [:hourly] begin
22

33
for city in ["Eindhoven", "Veldhoven", "Groningen"]
44

@@ -32,7 +32,7 @@
3232

3333
end
3434

35-
@testitem "Check if hourly rain forecast is available" begin
35+
@testitem "Check if hourly rain forecast is available" tags = [:hourly] begin
3636

3737
for city in ["Veldhoven", "Groningen", "The Hague"]
3838

@@ -66,7 +66,7 @@ end
6666

6767
end
6868

69-
@testitem "Check if hourly snow forecast is available" begin
69+
@testitem "Check if hourly snow forecast is available" tags = [:hourly] begin
7070

7171
for city in ["Oslo", "Tromso", "Trondheim"]
7272

test/plots_air_quality_test.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Run tests on plotting functions for air quality API
22

3-
@testitem "Plotting hourly air quality data with default selection" begin
3+
@testitem "Plotting hourly air quality data with default selection" tags = [:plots, :air] begin
44

55
@testset "plot_hourly_pm" begin
66
plt = plot_hourly_pm("Veldhoven", days = 3)
@@ -19,7 +19,7 @@
1919

2020
end
2121

22-
@testitem "Plotting hourly air quality data with multiple matches" begin
22+
@testitem "Plotting hourly air quality data with multiple matches" tags = [:plots, :air] begin
2323

2424
@testset "plot_hourly_pm" begin
2525
plt = plot_hourly_pm("Madrid", 2, days = 3)
@@ -47,7 +47,7 @@ end
4747

4848
end
4949

50-
@testitem "Plotting hourly air quality data with lat/long input" begin
50+
@testitem "Plotting hourly air quality data with lat/long input" tags = [:plots, :air] begin
5151

5252
@testset "plot_hourly_pm" begin
5353
# Denver
@@ -69,7 +69,7 @@ end
6969

7070
end
7171

72-
@testitem "Plotting air quality data with user preference" begin
72+
@testitem "Plotting air quality data with user preference" tags = [:plots, :air] begin
7373

7474
@testset "plot_hourly_pm" begin
7575
set_city("Bengaluru")

test/plots_box_monthly_test.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Run tests on monthly plotting functions (box plots) for historical data API
22

3-
@testitem "Box plots of monthly data with default selection" begin
3+
@testitem "Box plots of monthly data with default selection" tags = [:plots, :box] begin
44

55
@testset "plot_box_temp" begin
66
plt = plot_box_temp("Veldhoven",
@@ -40,7 +40,7 @@
4040

4141
end
4242

43-
@testitem "Box plots of monthly data with multiple matches" begin
43+
@testitem "Box plots of monthly data with multiple matches" tags = [:plots, :box] begin
4444

4545
@testset "plot_box_temp" begin
4646
plt = plot_box_temp("Madrid",
@@ -116,7 +116,7 @@ end
116116

117117
end
118118

119-
@testitem "Box plots of monthly data with lat/long input" begin
119+
@testitem "Box plots of monthly data with lat/long input" tags = [:plots, :box] begin
120120

121121
@testset "plot_box_temp" begin
122122
# Denver
@@ -168,7 +168,7 @@ end
168168

169169
end
170170

171-
@testitem "Box plots of monthly data with user preference" begin
171+
@testitem "Box plots of monthly data with user preference" tags = [:plots, :box] begin
172172

173173
@testset "plot_box_windspeed" begin
174174
set_city("Amsterdam")

test/plots_box_yearly_test.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Run tests on yearly plotting functions (box plots) for historical data API
22

3-
@testitem "Box plots of yearly data with default selection" begin
3+
@testitem "Box plots of yearly data with default selection" tags = [:plots, :box] begin
44

55
@testset "compare_box_temp" begin
66
plt = compare_box_temp("Veldhoven",
@@ -46,7 +46,7 @@
4646

4747
end
4848

49-
@testitem "Box plots of yearly data with multiple matches" begin
49+
@testitem "Box plots of yearly data with multiple matches" tags = [:plots, :box] begin
5050

5151
@testset "compare_box_temp" begin
5252
plt = compare_box_temp("Madrid",
@@ -134,7 +134,7 @@ end
134134

135135
end
136136

137-
@testitem "Box plots of yearly data with lat/long input" begin
137+
@testitem "Box plots of yearly data with lat/long input" tags = [:plots, :box] begin
138138

139139
@testset "compare_box_temp" begin
140140
# Denver
@@ -192,7 +192,7 @@ end
192192

193193
end
194194

195-
@testitem "Box plots of yearly data with user preference" begin
195+
@testitem "Box plots of yearly data with user preference" tags = [:plots, :box] begin
196196

197197
@testset "compare_box_windspeed" begin
198198
set_city("Copenhagen")

0 commit comments

Comments
 (0)