Skip to content

Commit

Permalink
Merge pull request #28 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
Add .github/workflows/release.yml
  • Loading branch information
AkihiroSuda authored Mar 8, 2021
2 parents d1464b9 + b1946a6 commit f84838d
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ jobs:
steps:
- uses: actions/checkout@master
- run: make test
cross:
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- uses: actions/checkout@master
- run: make artifacts
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release
on:
push:
tags:
- 'v*'
- 'test-action-release-*'
env:
GO111MODULE: on
jobs:
release:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.16.x
- uses: actions/checkout@v2
with:
path: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
- name: "Compile binaries"
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
run: make artifacts
- name: "SHA256SUMS"
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
run: |
( cd _output; sha256sum containerd-fuse-overlayfs-* ) | tee /tmp/SHA256SUMS
mv /tmp/SHA256SUMS _output/SHA256SUMS
- name: "The sha256sum of the SHA256SUMS file"
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
run: (cd _output; sha256sum SHA256SUMS)
- name: "Prepare the release note"
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
run: |
tag="${GITHUB_REF##*/}"
shasha=$(sha256sum _output/SHA256SUMS | awk '{print $1}')
cat <<-EOF | tee /tmp/release-note.txt
${tag}
(To be documented)
- - -
The binaries were built automatically on GitHub Actions.
The build log is available for 90 days: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
The sha256sum of the SHA256SUMS file itself is \`${shasha}\` .
EOF
- name: "Create release"
working-directory: go/src/github.com/AkihiroSuda/containerd-fuse-overlayfs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF##*/}"
asset_flags=()
for f in _output/*; do asset_flags+=("-a" "$f"); done
hub release create "${asset_flags[@]}" -F /tmp/release-note.txt --draft "${tag}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.test
bin
/_output
29 changes: 27 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
DESTDIR ?= /usr/local

VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
VERSION_TRIMMED := $(VERSION:v%=%)
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)

PKG_MAIN := github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc
PKG_VERSION := github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc/version

GO ?= go
export GO_BUILD=GO111MODULE=on CGO_ENABLED=0 $(GO) build -ldflags "-s -w -X $(PKG_VERSION).Version=$(VERSION) -X $(PKG_VERSION).Revision=$(REVISION)"

bin/containerd-fuse-overlayfs-grpc:
go build -o $@ ./cmd/containerd-fuse-overlayfs-grpc
$(GO_BUILD) -o $@ $(PKG_MAIN)

install:
install bin/containerd-fuse-overlayfs-grpc $(DESTDIR)/bin
Expand All @@ -21,4 +31,19 @@ test:
_test:
go test -exec rootlesskit -test.v -test.root

.PHONY: bin/containerd-fuse-overlayfs-grpc install uninstall clean test _test
TAR_FLAGS=--transform 's/.*\///g' --owner=0 --group=0

artifacts: clean
mkdir -p _output
GOOS=linux GOARCH=amd64 make
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-amd64.tar.gz bin/*
GOOS=linux GOARCH=arm64 make
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-arm64.tar.gz bin/*
GOOS=linux GOARCH=arm GOARM=7 make
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-arm-v7.tar.gz bin/*
GOOS=linux GOARCH=ppc64le make
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-ppc64le.tar.gz bin/*
GOOS=linux GOARCH=s390x make
tar $(TAR_FLAGS) -czvf _output/containerd-fuse-overlayfs-$(VERSION_TRIMMED)-linux-s390x.tar.gz bin/*

.PHONY: bin/containerd-fuse-overlayfs-grpc install uninstall clean test _test artifacts
3 changes: 3 additions & 0 deletions cmd/containerd-fuse-overlayfs-grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ import (
"path/filepath"

sddaemon "github.com/coreos/go-systemd/v22/daemon"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"

snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
"github.com/containerd/containerd/contrib/snapshotservice"

fuseoverlayfs "github.com/AkihiroSuda/containerd-fuse-overlayfs"
"github.com/AkihiroSuda/containerd-fuse-overlayfs/cmd/containerd-fuse-overlayfs-grpc/version"
)

// main is from https://github.com/containerd/containerd/blob/b9fad5e310fafb453def5f1e7094f4c36a9806d2/PLUGINS.md
func main() {
logrus.Infof("containerd-fuse-overlayfs-grpc Version=%q Revision=%q", version.Version, version.Revision)
// Provide a unix address to listen to, this will be the `address`
// in the `proxy_plugin` configuration.
// The root will be used to store the snapshots.
Expand Down
23 changes: 23 additions & 0 deletions cmd/containerd-fuse-overlayfs-grpc/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package version

// Version and Revision are filled in Makefile
var (
Version = "<unknown>"
Revision = "<unknown>"
)
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7
github.com/coreos/go-systemd/v22 v22.1.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.7.0
google.golang.org/grpc v1.30.0
)

Expand Down

0 comments on commit f84838d

Please sign in to comment.