Skip to content

Commit 1b3779e

Browse files
authored
Add workflows (#1)
1 parent f18ecf5 commit 1b3779e

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

.github/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
golangci-lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v4
15+
with:
16+
go-version: '1.20'
17+
- name: Setup libtensorflow
18+
run: script/install-libtensorflow
19+
- uses: golangci/golangci-lint-action@v3
20+
with:
21+
version: v1.52.2

.github/workflows/test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
gotest:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-go@v4
15+
with:
16+
go-version: '1.20'
17+
- name: Setup libtensorflow
18+
run: script/install-libtensorflow
19+
- name: Test
20+
uses: robherley/go-test-action@v0.1.0
21+
with:
22+
omitUntestedPackages: true

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# guesslang-go 🔍
22

3+
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://pkg.go.dev/github.com/robherley/guesslang-go)
4+
[![Test](https://github.com/robherley/guesslang-go/actions/workflows/test.yml/badge.svg)](https://github.com/robherley/guesslang-go/actions/workflows/test.yml)
5+
36
Go port of [yoeo/guesslang](https://github.com/yoeo/guesslang). Detects programming language of source code using a deep learning model.
47

58
## Setup

script/install-libtensorflow

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# This script downloads and installs libtensorflow (CPU only) for the current platform.
4+
# If you are on macOS, you can just use `brew install libtensorflow` instead.
5+
# https://www.tensorflow.org/install/lang_c
6+
7+
set -e
8+
9+
if [ "$(go env GOARCH)" != "amd64" ]; then
10+
echo "unsupported architecture: $ARCH"
11+
exit 1
12+
fi
13+
14+
OS=$(go env GOOS)
15+
16+
case "$OS" in
17+
darwin)
18+
brew install libtensorflow
19+
;;
20+
linux)
21+
TENSORFLOW_VERSION=2.11.0
22+
ARCHIVE_PATH=$(mktemp -d)/tensorflow.tar.gz
23+
curl -o "$ARCHIVE_PATH" "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-${OS}-x86_64-${TENSORFLOW_VERSION}.tar.gz"
24+
sudo tar -xzf "$ARCHIVE_PATH" -C /usr/local
25+
sudo ldconfig /usr/local/lib
26+
rm -rf "$ARCHIVE_PATH"
27+
;;
28+
*)
29+
echo "unsupported OS: $OS"
30+
exit 1
31+
;;
32+
esac

0 commit comments

Comments
 (0)