Skip to content

Commit 8a7eea0

Browse files
committed
testing semantic release
1 parent 6dc99b3 commit 8a7eea0

2 files changed

Lines changed: 99 additions & 79 deletions

File tree

.github/workflows/dart.yml

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,35 @@
1-
name: Dart CI
1+
name: cicd
22

33
on:
4-
# Run on PRs and pushes to the master branch.
54
push:
6-
branches: [master]
7-
pull_request:
8-
branches: [master]
9-
10-
env:
11-
PUB_ENVIRONMENT: bot.github
5+
branches:
6+
- master
127

138
jobs:
14-
15-
# runs dart test
16-
test:
9+
release:
10+
name: Release
1711
runs-on: ubuntu-20.04
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
sdk: [stable]
2212
steps:
23-
- uses: actions/checkout@v2
24-
- uses: dart-lang/setup-dart@v1.0
25-
with:
26-
sdk: stable
27-
- name: Install dependencies
28-
run: dart pub get
29-
- name: Run VM tests
30-
run: dart test --platform vm
31-
32-
# release
13+
- name: Checkout code
14+
uses: actions/checkout@v2
3315

34-
run-semantic-release:
35-
runs-on: ubuntu-latest
36-
needs: test
16+
- uses: cedx/setup-dart@v2
17+
- uses: actions/setup-node@v2
18+
with:
19+
node-version: 14
3720

38-
steps:
39-
- name: Checkout
40-
uses: actions/checkout@v2
21+
- run: npm install -g "@semantic-release/changelog"
22+
- run: npm install -g "@semantic-release/git"
23+
- run: npm install -g "semantic-release-dart"
4124

42-
- name: Run semantic-release
25+
- name: Bump version
4326
run: |
44-
export PATH=$PATH:$(yarn global bin)
45-
yarn global add semantic-release@17.4.3
46-
semantic-release
27+
export NODE_PATH="$(npm root -g)"
28+
npx semantic-release@17
29+
ls -lah
30+
git status
31+
cat pubspec.yaml
4732
env:
4833
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
50-
# semantic-release:
51-
# needs: test
52-
# runs-on: ubuntu-latest
53-
# steps:
54-
# - uses: actions/checkout@v2
55-
56-
# - name: Run semantic-release
57-
# if: github.repository == 'casbin/casbin' && github.event_name == 'push'
58-
# run: make release
59-
34+
- name: Publish to pub
35+
run: dart pub publish --dry-run

test/solar_test.dart

Lines changed: 77 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,93 +4,137 @@ import 'package:astro_calculations/src/solar_calc.dart';
44
import 'data/solar_test_data.dart';
55

66
void main() {
7-
group('Julian Day Tests', () {
8-
test('Get Julian Day from Gregorian Day', () {
9-
for (var dateTime in TestData['julianDayTestData'].keys) {
10-
expect(getJulianDay(dateTime), equals(TestData['julianDayTestData'][dateTime]));
11-
}
12-
});
13-
14-
test('Get Gregorian Day from Julian Day', () {
15-
final _reversedMap = TestData['julianDayTestData'].map((key, value) => MapEntry(value, key));
16-
for (var julianDay in TestData['julianDayTestData'].values) {
17-
expect(getGregorianDay(julianDay), equals(_reversedMap[julianDay]));
18-
}
19-
});
20-
});
21-
227
group('Heliocentric Calculations', () {
238
test('Get Heliocentric Latitude', () {
24-
expect(getHeliocentricLatitude(TestData['julianMillenium']), closeTo(TestData['heliocentricLatitude'], 0.001));
9+
expect(getHeliocentricLatitude(TestData['julianMillenium']),
10+
closeTo(TestData['heliocentricLatitude'], 0.001));
2511
});
2612

2713
test('Get Heliocentric longitude', () {
28-
expect(getHeliocentricLongitude(TestData['julianMillenium']), closeTo(TestData['heliocentricLongitude'], 0.001));
14+
expect(getHeliocentricLongitude(TestData['julianMillenium']),
15+
closeTo(TestData['heliocentricLongitude'], 0.001));
2916
});
3017

3118
test('Get Earth Radius Vector', () {
32-
expect(getEarthRadiusVector(TestData['julianMillenium']), closeTo(TestData['earthSunDistance'], 0.001));
19+
expect(getEarthRadiusVector(TestData['julianMillenium']),
20+
closeTo(TestData['earthSunDistance'], 0.001));
3321
});
3422
});
3523

3624
group('Get Nutation Values', () {
3725
final nutationValue = getNutation(TestData['julianEphemerisCentury']);
3826
test('Get Nutation longitude', () {
39-
expect(nutationValue.longitude, closeTo(TestData['nutation'].longitude, 0.0000001));
27+
expect(nutationValue.longitude,
28+
closeTo(TestData['nutation'].longitude, 0.0000001));
4029
});
4130
test('Get Nutation Obliquity', () {
42-
expect(nutationValue.obliquity, closeTo(TestData['nutation'].obliquity, 0.0000001));
31+
expect(nutationValue.obliquity,
32+
closeTo(TestData['nutation'].obliquity, 0.0000001));
4333
});
4434
});
4535

4636
test('Get true obliquity of ecliptic', () {
47-
expect(getTrueObliquityOfEcliptic(TestData['julianMillenium'], TestData['nutation']), closeTo(TestData['trueObliquityOfEcliptic'], 0.00001));
37+
expect(
38+
getTrueObliquityOfEcliptic(
39+
TestData['julianMillenium'], TestData['nutation']),
40+
closeTo(TestData['trueObliquityOfEcliptic'], 0.00001));
4841
});
4942

5043
test('Get Aberration Correction', () {
51-
expect(getAberrationCorrection(TestData['earthSunDistance']), closeTo(TestData['aberrationCorrection'], 0.00001));
44+
expect(getAberrationCorrection(TestData['earthSunDistance']),
45+
closeTo(TestData['aberrationCorrection'], 0.00001));
5246
});
5347

5448
test('Get Apparent Sun Longitude', () {
55-
expect(getApparentSunLongitude(TestData['geocentricLongitude'], TestData['nutation'], TestData['aberrationCorrection']), closeTo(TestData['apparentSunLongitude'], 0.001));
49+
expect(
50+
getApparentSunLongitude(TestData['geocentricLongitude'],
51+
TestData['nutation'], TestData['aberrationCorrection']),
52+
closeTo(TestData['apparentSunLongitude'], 0.001));
5653
});
5754

5855
test('Get Apparent Sidereal Time', () {
59-
expect(getApparentSiderealTime(TestData['julianDay'], TestData['julianMillenium'], TestData['nutation']), closeTo(TestData['apparentSiderealTime'], 0.01));
56+
expect(
57+
getApparentSiderealTime(TestData['julianDay'],
58+
TestData['julianMillenium'], TestData['nutation']),
59+
closeTo(TestData['apparentSiderealTime'], 0.01));
6060
});
6161
test('Get Geocentric Sun Right Ascension', () {
62-
expect(getGeocentricSunRightAscension(TestData['apparentSunLongitude'], TestData['trueObliquityOfEcliptic'], TestData['geocentricLatitude']), closeTo(TestData['geocentricRightAscension'], 0.001));
62+
expect(
63+
getGeocentricSunRightAscension(
64+
TestData['apparentSunLongitude'],
65+
TestData['trueObliquityOfEcliptic'],
66+
TestData['geocentricLatitude']),
67+
closeTo(TestData['geocentricRightAscension'], 0.001));
6368
});
6469
test('Get Geocentric Sun Declination', () {
65-
expect(getGeocentricSunDeclination(TestData['apparentSunLongitude'], TestData['trueObliquityOfEcliptic'], TestData['geocentricLatitude']), closeTo(TestData['geocentricSunDeclination'], 0.001));
70+
expect(
71+
getGeocentricSunDeclination(
72+
TestData['apparentSunLongitude'],
73+
TestData['trueObliquityOfEcliptic'],
74+
TestData['geocentricLatitude']),
75+
closeTo(TestData['geocentricSunDeclination'], 0.001));
6676
});
6777
test('get Observer local hour angle', () {
68-
expect(getLocalHourAngle(TestData['apparentSiderealTime'], TestData['longitude'], TestData['geocentricRightAscension']), closeTo(TestData['localHourAngle'], 0.01));
78+
expect(
79+
getLocalHourAngle(TestData['apparentSiderealTime'],
80+
TestData['longitude'], TestData['geocentricRightAscension']),
81+
closeTo(TestData['localHourAngle'], 0.01));
6982
});
7083

7184
group('Position of sun with respect to observer on earth', () {
7285
test('get Topocentric Right Ascension', () {
73-
expect(getTopocentricSunRightAscension(TestData['projectedRadialDistance'], TestData['equatorialHorizontalParallaxOfSun'], TestData['localHourAngle'], TestData['apparentSunLongitude'], TestData['trueObliquityOfEcliptic'], TestData['geocentricLatitude']), closeTo(TestData['topocentricSunRightAscension'], 0.001));
86+
expect(
87+
getTopocentricSunRightAscension(
88+
TestData['projectedRadialDistance'],
89+
TestData['equatorialHorizontalParallaxOfSun'],
90+
TestData['localHourAngle'],
91+
TestData['apparentSunLongitude'],
92+
TestData['trueObliquityOfEcliptic'],
93+
TestData['geocentricLatitude']),
94+
closeTo(TestData['topocentricSunRightAscension'], 0.001));
7495
});
7596
test('get Topocentric Sun Declination ', () {
76-
expect(getTopocentricSunDeclination(TestData['projectedAxialDistance'], TestData['equatorialHorizontalParallaxOfSun'], TestData['localHourAngle'], TestData['projectedRadialDistance'], TestData['geocentricSunDeclination']), closeTo(TestData['topocentricSunDeclination'], 0.0001));
97+
expect(
98+
getTopocentricSunDeclination(
99+
TestData['projectedAxialDistance'],
100+
TestData['equatorialHorizontalParallaxOfSun'],
101+
TestData['localHourAngle'],
102+
TestData['projectedRadialDistance'],
103+
TestData['geocentricSunDeclination']),
104+
closeTo(TestData['topocentricSunDeclination'], 0.0001));
77105
});
78106
});
79107

80108
test('get Topocentric Local Hour Angle', () {
81109
//Value of parallaxInSunRightAscension is calculated from this program itself since I couldn't find any data for it
82-
expect(getTopocentricLocalHourAngle(TestData['localHourAngle'], TestData['parallaxInSunRightAscension']), closeTo(TestData['topocentricLocalHourAngle'], 0.0001));
110+
expect(
111+
getTopocentricLocalHourAngle(TestData['localHourAngle'],
112+
TestData['parallaxInSunRightAscension']),
113+
closeTo(TestData['topocentricLocalHourAngle'], 0.0001));
83114
});
84115

85116
test('get Topocentric Zenith Angle', () {
86-
expect(getTopocentricZenithAngle(TestData['latitude'], TestData['topocentricSunDeclination'], TestData['topocentricLocalHourAngle'], TestData['pressure'], TestData['temperatureInCelsius']), closeTo(TestData['topocentricZenithAngle'], 0.0001));
117+
expect(
118+
getTopocentricZenithAngle(
119+
TestData['latitude'],
120+
TestData['topocentricSunDeclination'],
121+
TestData['topocentricLocalHourAngle'],
122+
TestData['pressure'],
123+
TestData['temperatureInCelsius']),
124+
closeTo(TestData['topocentricZenithAngle'], 0.0001));
87125
});
88126

89127
test('get Topocentric Azimuth Angle', () {
90-
expect(getTopocentricAzimuthAngle(TestData['topocentricLocalHourAngle'], TestData['latitude'], TestData['topocentricSunDeclination']), closeTo(TestData['topocentricAzimuthAngle'], 0.0001));
128+
expect(
129+
getTopocentricAzimuthAngle(TestData['topocentricLocalHourAngle'],
130+
TestData['latitude'], TestData['topocentricSunDeclination']),
131+
closeTo(TestData['topocentricAzimuthAngle'], 0.0001));
91132
});
92133

93134
test('get Topocentric Incidence Angle', () {
94-
expect(getIncidenceAngle(TestData['topocentricZenithAngle'], TestData['slope'], TestData['slopeOrientation'], TestData['topocentricAzimuthAngle']), closeTo(TestData['incidenceAngle'], 0.001));
135+
expect(
136+
getIncidenceAngle(TestData['topocentricZenithAngle'], TestData['slope'],
137+
TestData['slopeOrientation'], TestData['topocentricAzimuthAngle']),
138+
closeTo(TestData['incidenceAngle'], 0.001));
95139
});
96140
}

0 commit comments

Comments
 (0)