-
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.
Improve docker-compose Improve CI Improve Dockerfile Add the docstring Update the buf version
- Loading branch information
Showing
23 changed files
with
2,058 additions
and
70 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 |
---|---|---|
@@ -1,11 +1,35 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
# https://crontab.guru/ | ||
# At 12:00 AM, only on Monday | ||
- cron: 0 0 * * 1 | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
go-version: [1.17.x] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
shell: bash | ||
run: | | ||
make all | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build a Docker image | ||
run: docker build . --file Dockerfile --tag image:$(date +%s) | ||
- uses: actions/checkout@v2 | ||
- name: Build a Docker image | ||
run: docker build . --file Dockerfile --tag image:$(date +%s) |
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## Requirements | ||
|
||
Your task will be to build a simplified version of the Reddit feed API that powers | ||
http://old.reddit.com. **Please use Go as the programming language**. This will be a REST API | ||
that allows users to do the following: | ||
|
||
**Create new posts.** Posts should be validated for correctness. They should have the following | ||
fields: | ||
|
||
1. Title | ||
2. Author: This should be a random 8 character string prefixed with t2_. The 8 character | ||
string should only contain lowercase letters and numbers. For example, my user ID is | ||
t2_11qnzrqv. | ||
3. Link: This should be a valid URL. It's ok if your validation is not perfect. | ||
4. Subreddit: The subreddit associated with this post. | ||
5. Content: In the case of a text-only post. **A post cannot have both a link and content | ||
populated.** | ||
6. Score: The total score associated with the upvotes and downvotes of a post. | ||
7. Promoted: A boolean field indicating whether or not the post is an ad or not. | ||
8. NSFW: Not safe for work. A boolean that indicates whether or not the post is safe for | ||
work | ||
|
||
**Generate a feed of posts.** This feed should have the following characteristics: | ||
|
||
1. It should be ranked by score, and the post with the highest score should show up first. | ||
2. It should be paginated, and each page should have at most 27 posts. Your API should | ||
support fetching a specific page in the feed. | ||
3. If a page has 3 posts or greater, the second post should always be a promoted post if a | ||
promoted post is available, regardless of the score. | ||
4. If a page has greater than 16 posts, the 16th post should always be a promoted post if a | ||
promoted post is available, regardless of the score. | ||
5. As an exception to rules 3 and 4, **a promoted post should never be shown adjacent | ||
to an NSFW post**. You can ignore rules 3 and 4 in this case. |
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
Oops, something went wrong.