Skip to content

Commit

Permalink
Merge pull request #110 from DrDaveD/merge-sylabs-v2
Browse files Browse the repository at this point in the history
Merge sylabs/sif through v2.0.0
  • Loading branch information
DrDaveD authored Nov 12, 2021
2 parents b8e7868 + 243e059 commit 1ffc617
Show file tree
Hide file tree
Showing 126 changed files with 4,013 additions and 3,044 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,34 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.16.x'
go-version: '1.17.x'

- name: Check go.mod and go.sum are tidy
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Build Source
run: ./build.sh
run: go run mage.go build:source

- name: Install Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41
version: v1.42

- name: Run Lint
run: |
golangci-lint run
- name: Run Tests
run: go test -coverprofile=cover.out -race ./...
run: go run mage.go cover:unit cover.out

- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
files: cover.out
flags: unittests
name: codecov

- name: Test Release
run: curl -sL https://git.io/goreleaser | bash -s -- --snapshot --skip-publish
30 changes: 30 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
push:
tags:
- 'v*.*.*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
run:
build-tags:
- mage

linters:
disable-all: true
enable:
Expand All @@ -8,6 +12,7 @@ linters:
- dogsled
- dupl
- errcheck
- errname
- exportloopref
- gochecknoinits
- gocritic
Expand Down
45 changes: 45 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
project_name: siftool

release:
github:
owner: sylabs
name: sif
prerelease: auto

builds:
- binary: siftool
goos:
- darwin
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 6
- 7
env:
- CGO_ENABLED=0
ldflags: '-s -w -X main.version={{ .Version }} -X main.commit={{ .FullCommit }} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser'
main: ./cmd/siftool
mod_timestamp: '{{ .CommitTimestamp }}'

archives:
- format: tar.gz
wrap_in_directory: true
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
files:
- README.md

checksum:
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'

changelog:
sort: asc
filters:
exclude:
- '^dev:'
- '^docs:'
- '^test:'
- '^Merge branch'
- '^Merge pull request'
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ further defined and clarified by project maintainers.
### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project leaders ([email protected]). All
reported by contacting the project leader ([email protected]). All
complaints will be reviewed and investigated and will result in a response
that is deemed necessary and appropriate to the circumstances. The project
team is obligated to maintain confidentiality with regard to the reporter of
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![Build Status](https://circleci.com/gh/hpcng/sif.svg?style=shield)](https://circleci.com/gh/hpcng/workflows/sif)
[![Code Coverage](https://codecov.io/gh/hpcng/sif/branch/master/graph/badge.svg)](https://codecov.io/gh/hpcng/sif)
[![Go Report Card](https://goreportcard.com/badge/github.com/hpcng/sif)](https://goreportcard.com/report/github.com/hpcng/sif)
[![Built with Mage](https://magefile.org/badge.svg)](https://magefile.org)

This module contains an open source implementation of the Singularity Image Format (SIF) that makes it easy to create complete and encapsulated container environments stored in a single file.

Expand All @@ -16,15 +17,15 @@ Unless otherwise noted, the SIF source files are distributed under the BSD-style
To get the sif package to use directly from your programs:

```sh
go get -u github.com/hpcng/sif/v2
go get -d github.com/hpcng/sif/v2
```

To get the siftool CLI program installed to `$(go env GOPATH)/bin` to manipulate SIF container files:

```sh
git clone https://github.com/hpcng/sif
cd sif
./build.sh
go run mage.go install
```

## Go Version Compatibility
Expand Down
9 changes: 0 additions & 9 deletions build.sh

This file was deleted.

45 changes: 40 additions & 5 deletions cmd/siftool/siftool.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,60 @@ package main

import (
"fmt"
"io"
"os"
"runtime"
"text/tabwriter"

"github.com/hpcng/sif/v2/pkg/sif"
"github.com/hpcng/sif/v2/pkg/siftool"
"github.com/spf13/cobra"
)

var version = "unknown"
var (
version = "unknown"
date = ""
builtBy = ""
commit = ""
state = ""
)

func writeVersion(w io.Writer) error {
tw := tabwriter.NewWriter(w, 0, 0, 2, ' ', 0)
defer tw.Flush()

fmt.Fprintf(tw, "Version:\t%v\n", version)

if date != "" {
fmt.Fprintf(tw, "Built:\t%v\n", date)
}

if builtBy != "" {
fmt.Fprintf(tw, "By:\t%v\n", builtBy)
}

if commit != "" {
if state == "" {
fmt.Fprintf(tw, "Commit:\t%v\n", commit)
} else {
fmt.Fprintf(tw, "Commit:\t%v (%v)\n", commit, state)
}
}

fmt.Fprintf(tw, "Runtime:\t%v (%v/%v)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
fmt.Fprintf(tw, "Spec:\t%v\n", sif.CurrentVersion)

return nil
}

func getVersion() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Display version information",
Long: "Display binary version and compatible SIF version(s).",
Long: "Display binary version, build info and compatible SIF version(s).",
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
cmd.Printf("siftool version %s %s/%s\n", version, runtime.GOOS, runtime.GOARCH)
cmd.Printf("SIF spec versions supported: <= %s\n", sif.CurrentVersion)
RunE: func(cmd *cobra.Command, args []string) error {
return writeVersion(cmd.OutOrStdout())
},
DisableFlagsInUseLine: true,
}
Expand Down
28 changes: 26 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
module github.com/hpcng/sif/v2

go 1.15
go 1.17

require (
github.com/ProtonMail/go-crypto v0.0.0-20210707164159-52430bf6b52c
github.com/blang/semver/v4 v4.0.0
github.com/go-git/go-git/v5 v5.4.2
github.com/google/uuid v1.3.0
github.com/magefile/mage v1.11.0
github.com/sebdah/goldie/v2 v2.5.3
github.com/spf13/cobra v1.2.1
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
github.com/spf13/pflag v1.0.5
)

require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
Loading

0 comments on commit 1ffc617

Please sign in to comment.