-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
82 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Continuous Deployment | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
name: Build and publish Docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
- name: Build and publish | ||
run: ./build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Continuous Integration | ||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test | ||
run: go test -v ./... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module duolingo | ||
|
||
go 1.21.0 | ||
go 1.21 | ||
|
||
require github.com/tdewolff/canvas v0.0.0-20230725155945-641901f69684 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package utils | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
func GetBeginningOfMonth() time.Time { | ||
now := time.Now() | ||
return time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, time.UTC) | ||
} | ||
|
||
func FormatBeginningOfMonth(date time.Time) string { | ||
return date.Format("2006-01-02") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package utils | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
func TestGetBeginningOfMonth(t *testing.T) { | ||
date := GetBeginningOfMonth() | ||
if date.Day() != 1 { | ||
t.Fatalf("Expected day to be 1, got %d", date.Day()) | ||
} | ||
if date.Hour() != 0 { | ||
t.Fatalf("Expected hour to be 0, got %d", date.Hour()) | ||
} | ||
if date.Minute() != 0 { | ||
t.Fatalf("Expected minute to be 0, got %d", date.Minute()) | ||
} | ||
if date.Second() != 0 { | ||
t.Fatalf("Expected second to be 0, got %d", date.Second()) | ||
} | ||
if date.Nanosecond() != 0 { | ||
t.Fatalf("Expected nanosecond to be 0, got %d", date.Nanosecond()) | ||
} | ||
} | ||
|
||
func TestFormatBeginningOfMonth(t *testing.T) { | ||
date := FormatBeginningOfMonth(time.Date(2021, 10, 1, 0, 0, 0, 0, time.UTC)) | ||
if date != "2021-10-01" { | ||
t.Fatalf("Expected date to be 2021-10-01, got %s", date) | ||
} | ||
} |