Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Go 1.18 #162

Merged
merged 8 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.18
id: go

- name: Check out code into the Go module directory
Expand All @@ -22,13 +22,13 @@ jobs:
run: go mod download

- name: Run tests
run: go test -v ./...
run: GODEBUG=x509sha1=1 go test -v ./...

- name: Build binaries
run: ./build
run: go build -o . ./...

- name: Run integration tests
run: ./integration_test
run: GODEBUG=x509sha1=1 go test -v -tags=integration ./...

lint:
name: Lint
Expand All @@ -45,7 +45,7 @@ jobs:
# Exclude deprecated PEM functions from the linter until
# https://github.com/square/certstrap/issues/124 is resolved
args: --exclude '(De|En)cryptPEMBlock'

build-windows:
name: Build Windows
runs-on: windows-latest
Expand All @@ -64,10 +64,14 @@ jobs:
run: go mod download

- name: Run tests
run: go test -v ./...
run: |
set GODEBUG=x509sha1=1
go test -v ./...

- name: Build binaries
run: ./build
run: go build -o . ./...

- name: Run integration tests
run: ./integration_test
run: |
set GODEBUG=x509sha1=1
go test -v -tags=integration ./...
80 changes: 80 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: Release

on:
push:
tags: [ "*" ]

jobs:
build:
name: Build
strategy:
matrix:
version: [1.18.x]
target:
- { os: 'darwin', platform: 'macos-latest', arch: 'amd64' }
- { os: 'linux', platform: 'ubuntu-latest', arch: 'amd64' }
- { os: 'windows', platform: 'windows-latest', arch: 'amd64' }
runs-on: ${{ matrix.target.platform }}
steps:
- name: Set up toolchain
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.version }}
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Build binary
run: go build -o certsrap .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: certstrap-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: certstrap

release:
name: Create release
runs-on: ubuntu-latest
needs: [ build ]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Release Build (Draft)"
body: "Release Build (from ${{ github.ref }}/${{ github.sha }})"
draft: true
prerelease: true

add-assets:
name: Add assets
runs-on: ubuntu-latest
needs: [ build, release ]
strategy:
matrix:
target:
- { os: 'darwin', arch: 'amd64' }
- { os: 'linux', arch: 'amd64' }
- { os: 'windows', arch: 'amd64' }
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: certstrap-${{ matrix.target.os }}-${{ matrix.target.arch }}
path: dist
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./dist/certstrap
asset_name: certstrap-${{ matrix.target.os }}-${{ matrix.target.arch }}
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ certstrap can init multiple certificate authorities to sign certificates with.

### Building

certstrap must be built with Go 1.13+. You can build certstrap from source:
certstrap must be built with Go 1.18+. You can build certstrap from source:

```
$ git clone https://github.com/square/certstrap
Expand Down
17 changes: 0 additions & 17 deletions build

This file was deleted.

3 changes: 1 addition & 2 deletions certstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
"github.com/urfave/cli"
)

// release is overriden by the build script using -X argument that is passed to the Go linker.
var release = "(version not set)"
var release = "1.3.0"

func main() {
app := cli.NewApp()
Expand Down
13 changes: 12 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
module github.com/square/certstrap

go 1.18

require (
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c
github.com/urfave/cli v1.22.9
go.step.sm/crypto v0.16.2
)

go 1.16
require (
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
)
11 changes: 0 additions & 11 deletions integration_test

This file was deleted.

6 changes: 2 additions & 4 deletions tests/basic_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build integration
// +build integration

/*-
Expand All @@ -21,11 +22,8 @@ package tests

import (
"bytes"
"fmt"
"io"
"os"
"os/exec"
"runtime"
"strings"
"testing"
)
Expand All @@ -36,7 +34,7 @@ const (
passphrase = "123456"
)

var binPath = fmt.Sprintf("../bin/certstrap-%s-%s-amd64", os.Getenv("BUILD_TAG"), runtime.GOOS)
var binPath = "../certstrap"

func run(command string, args ...string) (string, string, error) {
var stdoutBytes, stderrBytes bytes.Buffer
Expand Down