Skip to content

Commit

Permalink
Test and deploy FE from CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
raahii committed Jul 18, 2022
1 parent 3cee53b commit e84be9e
Show file tree
Hide file tree
Showing 13 changed files with 19,514 additions and 6,297 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: ci-workflow

on: [push]

jobs:
# Run on push on all branches
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

# Run on push on main branch only and require unit-test job success
deploy-frontend:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

defaults:
run:
working-directory: frontend

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18.x

- name: Build code
run: npm ci && npm run build

- name: Deploy resources to Netlify
run: npx netlify-cli deploy --prod --dir=./dist
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
1 change: 0 additions & 1 deletion .go-version

This file was deleted.

24 changes: 0 additions & 24 deletions arxiv/arxiv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,3 @@ func TestDownloadTarball(t *testing.T) {
t.Fatalf("failed test %#v", err)
}
}

func TestSearchPaper(t *testing.T) {
result := SearchPaper("Generative Adversarial Nets")

if result.TotalResults <= 0 {
t.Fatalf("total numbers of results must be more than 0")
}
}

func TestEprintUrl(t *testing.T) {
paper := Entry{}
link := Link{"pdf", "http://arxiv.org/pdf/astro-ph/0608371v1.pdf", ""}
paper.Links = []Link{link}

actual, err := EprintUrl(paper)
if err != nil {
t.Fatalf("The function returned error %#v", err)
}

expected := "http://arxiv.org/e-print/astro-ph/0608371v1"
if actual != expected {
t.Fatalf("\ngot %#v\nwant %#v", actual, expected)
}
}
2 changes: 1 addition & 1 deletion controllers/papers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func FindPaper(c echo.Context) error {
err := DB.Where("arxiv_id = ?", arxivId).First(&paper).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
// if the paper doesn't exist in the database, fetch the paper
paper, err := FetchPaper(arxivId)
paper, err = FetchPaper(arxivId)
if err != nil {
return err
}
Expand Down
29 changes: 0 additions & 29 deletions frontend/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/config/dev.env.js

This file was deleted.

67 changes: 0 additions & 67 deletions frontend/config/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions frontend/config/prod.env.js

This file was deleted.

Loading

0 comments on commit e84be9e

Please sign in to comment.