Skip to content

Commit

Permalink
fix: build and add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cchampou committed Nov 4, 2023
1 parent 617fbab commit 0ba96ef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: Build the Docker image
on: [push]
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ COPY assets ./assets

RUN chmod +x executable

CMD ["/app/executable"]
CMD ["./executable"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ image is saved to a file named "leaderboard.png".

## Build and deploy the app

Run `go build . -o executable`.
Run `go build -o executable`.

ℹ️ If you're are build for an other OS or arch,
make sure to define GOOS and GOARCH. For example, to build for linux on amd64,
run `GOOS=linux GOARCH=amd64 go build . -o executable`.
run `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o executable`.

For the application to run properly, the asset folder needs to be alongside
the executable, so don't forget it if you're moving the executable to a container
Expand Down
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#/bin/sh

echo "Building the executable for linux"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o executable

echo "Building the docker image"
docker build . -t cchampou/go:latest

echo "Pushing the docker image"
docker push cchampou/go:latest
2 changes: 1 addition & 1 deletion duolingo/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type XPSummaries struct {
}

func getXPGains(userId int) int {
req, newRequestErr := http.NewRequest("GET", BaseURL+"/users/"+strconv.Itoa(userId)+"/xp_summaries?startDate=2023-10-01", nil)
req, newRequestErr := http.NewRequest("GET", BaseURL+"/users/"+strconv.Itoa(userId)+"/xp_summaries?startDate=2023-11-01", nil)
if newRequestErr != nil {
println("Error creating request")
return 0
Expand Down

0 comments on commit 0ba96ef

Please sign in to comment.