Skip to content

Commit

Permalink
Merge branch 'master' into feat/244-add-ntlm-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Gearheads authored Jun 15, 2023
2 parents 9af7d36 + 83489ec commit 05b8829
Show file tree
Hide file tree
Showing 116 changed files with 8,499 additions and 12,542 deletions.
4 changes: 2 additions & 2 deletions .appveyor/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ environment:
secure: 3kWTz99Qj+ipyaR73CxcJeGRRbmk84MF2ERDu6MyY10cjHAi6s3AVZ2Ccoa+Ioyt
appName: saml2aws
install:
- set PATH=C:\msys64\mingw64\bin;C:\go118\bin;%PATH%
- set GOROOT=C:\go118
- set PATH=C:\msys64\mingw64\bin;C:\go120\bin;%PATH%
- set GOROOT=C:\go120
- ps: >-
$VerbosePreference = 'Continue'
Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.buildtemp
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ updates:
interval: "weekly"
labels:
- "type: dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "type: dependencies"
2 changes: 2 additions & 0 deletions .github/win-msi/out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**
!.gitignore
28 changes: 28 additions & 0 deletions .github/win-msi/src/saml2aws.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="042c301c-5154-4a77-9438-a01d4d2a9dd4" Version="$(var.Saml2AwsVer)" Language="1033" Name="saml2aws" Manufacturer="Versent">
<Package InstallerVersion="300" Compressed="yes" Description="!(bind.property.ProductName) !(bind.property.ProductVersion)" Platform="x64"/>
<Media Id="1" Cabinet="saml2aws.cab" EmbedCab="yes" />

<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Versent"/>
</Directory>
</Directory>

<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="saml2aws.exe" Guid="4909b826-b4d1-4f46-9b55-ab765a04dc24" Win64="yes">
<File Id="saml2awscli" Name="saml2aws.exe" Source="src\bin\saml2aws.exe" KeyPath="yes" Checksum="yes"/>
<!-- Set the PATH to include the binary -->
<Environment Id="PATH" Name="PATH" Value="[APPLICATIONROOTDIRECTORY]" Permanent="no" Part="last" Action="set" System="yes" />
</Component>
</DirectoryRef>

<!-- Step 3: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="saml2aws CLI" Level="1">
<ComponentRef Id="saml2aws.exe" />
</Feature>
</Product>
</Wix>
3 changes: 3 additions & 0 deletions .github/win-msi/wix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
candle src/saml2aws.wxs -dSaml2AwsVer=${VERSION} -o "out/"
light -sval "out/saml2aws.wixobj" -o "out/saml2aws_${VERSION}_windows_amd64.msi"
112 changes: 77 additions & 35 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,109 @@ name: Go

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:

build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, macos-11]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Test
run: |
go test -v ./... -coverprofile=${{ matrix.os }}_coverage.txt -covermode=atomic
- name: Test
run: go test -v ./...
- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: reports
path: ${{ matrix.os }}_coverage.txt
if-no-files-found: error
retention-days: 1

- name: Install
run: go install ./cmd/saml2aws
- name: Install
run: go install ./cmd/saml2aws

linting:
name: lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.2
args: --timeout=2m

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.45.2
coverage:
name: coverage
permissions:
contents: read
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- name: Download coverage reports
uses: actions/download-artifact@v3
with:
name: reports
path: reports

- name: Codecov
uses: codecov/codecov-action@v3
with:
directory: reports
flags: unittests

release-build:
name: release-build
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.20.x

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.18.x
- name: Install dependency required for linux builds
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get update && sudo apt-get install -y libudev-dev

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: build --snapshot --clean --config .goreleaser.${{ matrix.os }}.yml

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: build --snapshot --rm-dist
- name: Upload
uses: actions/upload-artifact@v3
with:
name: saml2aws
path: dist/
100 changes: 94 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,113 @@ on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: The tag to run against. This trigger only runs the MSI builder.
required: true

jobs:
release:
name: release
runs-on: macOS-latest
strategy:
# the goreleaser and the Github release API doesn't handle concurrent
# access well, so run goreleaser serially
max-parallel: 1
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- macos-latest
runs-on: ${{ matrix.os }}
if: github.event_name != 'workflow_dispatch'
permissions: write-all
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.18.x
go-version: 1.20.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install dependency required for linux builds
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get update && sudo apt-get install -y libudev-dev

- name: Add Lowercase Repository Name to Environment
run: |
echo REPOSITORY_NAME_LOWERCASE=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- uses: "docker/login-action@v2"
if: matrix.os == 'ubuntu-20.04'
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
args: release --clean --config .goreleaser.${{ matrix.os }}.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_NAME: ${{ env.REPOSITORY_NAME_LOWERCASE }}

windows-msi:
name: Build Windows MSI and upload to release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [release]
if: >- # https://github.com/actions/runner/issues/491
always() &&
(needs.release.result == 'success' || needs.release.result == 'skipped')
env:
INSTALLER: ${{ github.workspace }}/.github/win-msi
BIN: ${{ github.workspace }}/.github/win-msi/src/bin
WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c
steps:
- name: Normalize tag values
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
VER=${{ github.event.inputs.tag }}
else
VER=${GITHUB_REF/refs\/tags\//}
fi
VERSION=${VER//v}
echo "VER_TAG=$VER" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v3

- name: Retrieve the release asset
id: asset
uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51 # v1.8
with:
repository: ${{ github.repository }}
tag: ${{ env.VER_TAG }}
fileName: ${{ env.ASSET }}
out-file-path: ${{ env.BIN }}

- name: Unzip asset
working-directory: ${{ env.BIN }}
run: unzip "${ASSET}"

- name: Build MSI
run: |
# container does not run as root
chmod -R o+rw "${INSTALLER}"
cat "${INSTALLER}/wix.sh" | docker run --rm -i -e VERSION -v "${INSTALLER}:/wix" ${WIXIMG} /bin/sh
- name: Upload the asset to the release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 / v1
with:
tag_name: ${{ env.VER_TAG }}
files: ${{ env.INSTALLER }}/out/*.msi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ vendor
/package
/stage
coverage.txt
coverage.xml
.ctags
.vscode
bin/
Expand All @@ -19,3 +20,4 @@ bin/

# direnv
.envrc
.buildtemp
3 changes: 0 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ linters:
disable-all: true
enable:
- goimports
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
7 changes: 2 additions & 5 deletions .goreleaser.yml → .goreleaser.macos-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@ builds:
ldflags:
- -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
- arm
archives:
- format: tar.gz
wrap_in_directory: false
format_overrides:
- goos: windows
format: zip
# remove README and LICENSE
files:
- LICENSE.md
- README.md
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_darwin_checksums.txt"
Loading

0 comments on commit 05b8829

Please sign in to comment.