Skip to content

Commit

Permalink
add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
robherley committed Apr 21, 2023
1 parent f18ecf5 commit 7805fdb
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on:
push:

permissions:
contents: read

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test

on:
push:

permissions:
contents: read

jobs:
gotest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Setup libtensorflow
run: script/install-libtensorflow
- name: Test
uses: robherley/go-test-action@v0.1.0
with:
omitUntestedPackages: true
30 changes: 30 additions & 0 deletions script/install-libtensorflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# This script downloads and installs libtensorflow (CPU only) for the current platform.
# If you are on macOS, you can just use `brew install libtensorflow` instead.
# https://www.tensorflow.org/install/lang_c

set -e

if [ "$(go env GOARCH)" != "amd64" ]; then
echo "unsupported architecture: $ARCH"
exit 1
fi

case "$(go env GOOS)" in
darwin)
brew install libtensorflow
;;
linux)
TENSORFLOW_VERSION=2.11.0
ARCHIVE_PATH=$(mktemp -d)/tensorflow.tar.gz
curl -o "$ARCHIVE_PATH" "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-${OS}-x86_64-${TENSORFLOW_VERSION}.tar.gz"
sudo tar -xzf "$ARCHIVE_PATH" -C /usr/local
sudo ldconfig /usr/local/lib
rm -rf "$ARCHIVE_PATH"
;;
*)
echo "unsupported OS: $(go env GOOS)"
exit 1
;;
esac

0 comments on commit 7805fdb

Please sign in to comment.