Skip to content

Commit

Permalink
Added GitHub actions to test, build and publish.
Browse files Browse the repository at this point in the history
Also added some badges to link to the action outcomes.
  • Loading branch information
LTLA committed Mar 2, 2024
1 parent d56d2a9 commit e2df75f
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Unit tests

on:
push:
branches:
- master
paths:
- '**.go'
- 'go.**'
- .github/workflows/build.yaml
pull_request:
paths:
- '**.go'
- 'go.**'
- .github/workflows/build.yaml

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
cache-dependency-path: go.sum

- name: Install dependencies
run: |
go get .
- name: Run tests
run: go test -v

build:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
strategy:
matrix:
os: [ linux, darwin ]
arch: [ amd64, arm64 ]

steps:
- name: Check out
uses: actions/checkout@v4

- name: Build latest
uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.os }}
goarch: ${{ matrix.arch }}
release_tag: latest
asset_name: gobbler-${{ matrix.os }}-${{ matrix.arch }}
overwrite: true
compress_assets: false
36 changes: 36 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish version

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Create release
uses: softprops/action-gh-release@v1

publish:
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
os: [ linux, darwin ]
arch: [ amd64, arm64 ]

steps:
- name: Check out
uses: actions/checkout@v4

- name: Publish binaries
uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.os }}
goarch: ${{ matrix.arch }}
release_tag: ${{ github.ref_name }}
asset_name: gobbler-${{ matrix.os }}-${{ matrix.arch }}
overwrite: true
compress_assets: false
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Collecting random shit from a shared filesystem

[![Test and build](https://github.com/ArtifactDB/SewerRat/actions/workflows/build.yaml/badge.svg)](https://github.com/ArtifactDB/SewerRat/actions/workflows/build.yaml)
[![Publish version](https://github.com/ArtifactDB/SewerRat/actions/workflows/publish.yaml/badge.svg)](https://github.com/ArtifactDB/SewerRat/actions/workflows/publish.yaml)
[![Latest version](https://img.shields.io/github/v/tag/ArtifactDB/SewerRat?label=Version)](https://github.com/ArtifactDB/SewerRat/releases)

## Introduction

SewerRat retrieves user-supplied metadata from a shared filesystem and indexes them into a giant SQLite file.
Expand Down

0 comments on commit e2df75f

Please sign in to comment.