Skip to content

Commit

Permalink
convert to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nssteinbrenner committed Dec 22, 2023
1 parent 79ee595 commit e76574e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 43 deletions.
31 changes: 0 additions & 31 deletions .drone.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


name: Go

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

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

- name: Test
run: go test -v ./... -file ./test/data.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Anitogo [![License](https://img.shields.io/github/license/nssteinbrenner/anitogo)](https://www.mozilla.org/en-US/MPL/2.0/) [![Godoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/nssteinbrenner/anitogo) [![Go Report Card](https://goreportcard.com/badge/github.com/nssteinbrenner/anitogo)](https://goreportcard.com/report/github.com/nssteinbrenner/anitogo) [![Build Status](https://cloud.drone.io/api/badges/nssteinbrenner/anitogo/status.svg)](https://cloud.drone.io/nssteinbrenner/anitogo) [![codecov](https://codecov.io/gh/nssteinbrenner/anitogo/branch/master/graph/badge.svg)](https://codecov.io/gh/nssteinbrenner/anitogo)
# Anitogo [![License](https://img.shields.io/github/license/nssteinbrenner/anitogo)](https://www.mozilla.org/en-US/MPL/2.0/) [![Godoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/nssteinbrenner/anitogo)

Anitogo is a Golang library for parsing anime video filenames. It is based off of [Anitomy](https://github.com/erengy/anitomy) and [Anitopy](https://github.com/igorcmoura/anitopy).

Expand Down Expand Up @@ -76,7 +76,7 @@ The Parse function returns a pointer to an Elements struct. The full definition
AnimeSeason []string `json:"anime_season,omitempty"`
AnimeSeasonPrefix []string `json:"anime_season_prefix,omitempty"`
AnimeTitle string `json:"anime_title,omitempty"`
AnimeType []string `json:"anime_type,omitempty"`
AnimeType []string `json:"anime_type,omitempty"`
AnimeYear string `json:"anime_year,omitempty"`
AudioTerm []string `json:"audio_term,omitempty"`
DeviceCompatibility []string `json:"device_compatibility,omitempty"`
Expand Down
15 changes: 5 additions & 10 deletions anitogo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package anitogo

import (
"encoding/json"
"flag"
"io/ioutil"
"os"
"testing"
Expand All @@ -12,11 +13,9 @@ type failedParse struct {
Got Elements `json:"got"`
}

var testDataPath = flag.String("file", "./test/data.json", "Path to test data JSON")

func TestAnitogoParse(t *testing.T) {
testDataPath := os.Getenv("TEST_DATA_PATH")
if testDataPath == "" {
t.Fatal("Missing TEST_DATA_PATH environment variable for json test data file")
}
retElems := Parse("", DefaultOptions)
if retElems.FileName != "" {
t.Error("expected empty elements")
Expand All @@ -34,7 +33,7 @@ func TestAnitogoParse(t *testing.T) {

e := []Elements{}
notMatched := []failedParse{}
jsonFile, err := os.Open(testDataPath)
jsonFile, err := os.Open(*testDataPath)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -200,12 +199,8 @@ func TestAnitogoRemoveExtensionFromFilename(t *testing.T) {
}

func BenchmarkAnitogoParse(b *testing.B) {
testDataPath := os.Getenv("TEST_DATA_PATH")
if testDataPath == "" {
b.Fatal("Missing TEST_DATA_PATH environment variable for json test data file")
}
e := []Elements{}
jsonFile, err := os.Open(testDataPath)
jsonFile, err := os.Open(*testDataPath)
if err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit e76574e

Please sign in to comment.