-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from OdyseeTeam/cache-sf
add some sort of caching/singleflight to comment list (replies count)
- Loading branch information
Showing
27 changed files
with
282 additions
and
348 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,86 @@ | ||
name: CI | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 # equivalent to 'dist: focal' | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
|
||
- name: start Default Ubuntu MySQL | ||
run: sudo systemctl start mysql.service | ||
|
||
- name: Before Install | ||
run: | | ||
sudo mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS commentron;' | ||
sudo mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS social;' | ||
sudo mysql -u root -proot -e "CREATE USER 'lbry-rw'@'localhost' IDENTIFIED BY 'lbry';" | ||
sudo mysql -u root -proot -e "CREATE USER 'lbry-ro'@'localhost' IDENTIFIED BY 'lbry';" | ||
sudo mysql -u root -proot -e "GRANT ALL ON commentron.* TO 'lbry-rw'@'localhost';" | ||
sudo mysql -u root -proot -e "GRANT SELECT ON commentron.* TO 'lbry-ro'@'localhost';" | ||
sudo mysql -u root -proot -e "GRANT ALL ON social.* TO 'lbry-rw'@'localhost';" | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
${{ runner.home }}/go/pkg/mod | ||
${{ runner.home }}/.cache/go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Add SSH Go Module Private Key | ||
env: | ||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
run: | | ||
mkdir -p ~/.ssh | ||
ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | ||
ssh-add - <<< "${{ secrets.GO_MODULE_PRIVATE_KEY }}" | ||
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV | ||
- name: Setup access for private go modules | ||
run: | | ||
git config --global url."ssh://[email protected]/".insteadOf https://github.com/ | ||
- name: Run Scripts and Tests | ||
env: | ||
GOPRIVATE: github.com/OdyseeTeam | ||
IS_TEST: true | ||
SDK_URL: https://api.lbry.tv/api/v1/proxy | ||
run: | | ||
./scripts/build.sh | ||
./scripts/lint.sh | ||
source ./scripts/setup.sh | ||
./bin/commentron serve & | ||
sleep 5s | ||
curl -i -H 'Accept: application/json' -H 'Content-Type: application/json' http://localhost:5900 | ||
go test ./... | ||
go mod tidy | ||
git diff --exit-code | ||
./scripts/gen_models.sh | ||
sqlboiler --version | ||
git diff --exit-code | ||
./bin/commentron test | ||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/branch-names@v7 | ||
|
||
- name: Deploy | ||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
BRANCH_NAME: ${{ steps.branch-name.outputs.current_branch }} | ||
if: github.event_name == 'push' | ||
run: | | ||
bash docker/docker.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env bash | ||
## test ci | ||
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin | ||
docker build --tag odyseeteam/commentron:$TRAVIS_BRANCH ./ | ||
docker push odyseeteam/commentron:$TRAVIS_BRANCH | ||
docker build --tag odyseeteam/commentron:$BRANCH_NAME ./ | ||
docker push odyseeteam/commentron:$BRANCH_NAME |
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.