Skip to content

Commit

Permalink
Add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
petarov committed Apr 23, 2024
1 parent 2ad2565 commit 244e29f
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### What is this about?

Description or closes #<issue>

### Breaking change No

Yes/No?

### How can it be verified?

Test case or unit tests?

### ToDo

- [ ] Unit tests
- [ ] Edit README, if needed
- [ ] Format source code by running `make fmt`
- [ ] Pass the test by `go test -v`
- [ ] Enable "Allow edits from maintainers" for this PR
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI Build

on:
push:
paths:
- "**.go"
- "go.mod"
- "go.sum"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.18', '1.22' ]
steps:
- name: Set up Go v${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v4

- name: Install deps
run: |
go version
go get -v -d ./...
- name: Cache modules
uses: actions/cache@v4
with:
path: $GOPATH/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go

- name: Vet code
run: go vet
- name: Build
run: go build -v .
- name: Test with Go
run: go test -v > TestResults-${{ matrix.go-version }}.txt
- name: Upload Go test results
uses: actions/upload-artifact@v4
with:
name: Test-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.txt
36 changes: 36 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI Check PR

on: [ pull_request_target ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.18', '1.22' ]
steps:
- name: Set up Go v${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v4

- name: Install deps
run: |
go version
go get -v -d ./...
- name: Cache modules
uses: actions/cache@v2
with:
path: $GOPATH/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go

- name: Vet code
run: go vet

- name: Sample Build
run: go build -v .
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ Transliteration of Bulgarian to Latin characters for Go

# Usage

TODO
```go
tr := translitbg.New()
tr.Run("абвгдежзийклмнопрстуфхцчшщъьюя)
// Output: abvgdezhziyklmnoprstufhtschshshtayyuya
```
# References
Expand Down
4 changes: 3 additions & 1 deletion translitbg_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package translitbg

import "testing"
import (
"testing"
)

func TestAlphabet(t *testing.T) {
expected := "abvgdezhziyklmnoprstufhtschshshtayyuyai"
Expand Down

0 comments on commit 244e29f

Please sign in to comment.