53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
pull_request:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16
|
|
|
|
- name: Deps
|
|
run: |
|
|
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
|
|
chmod 700 get_helm.sh
|
|
./get_helm.sh
|
|
|
|
wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
|
|
tar xf kubeval-linux-amd64.tar.gz
|
|
sudo cp kubeval /usr/local/bin
|
|
|
|
git clone https://github.com/DataDog/helm-unittest.git
|
|
cd helm-unittest
|
|
export VERSION=$(sed -n -e 's/version:[ "]*\([^"]*\).*/\1/p' plugin.yaml)
|
|
export LDFLAGS="-X main.version=$VERSION -extldflags '-static'"
|
|
echo $LDFLAGS
|
|
go build -o untt -ldflags "$LDFLAGS" ./main.go
|
|
export HELM_PLUGINS=$(helm env | grep "HELM_PLUGINS" | awk -F"=" '{print $2;}' | awk -F\" '{print $2;}')
|
|
export HELM_PLUGIN_DIR=$HELM_PLUGINS/helm-unittest
|
|
mkdir -p $HELM_PLUGIN_DIR
|
|
cp untt $HELM_PLUGIN_DIR
|
|
cp plugin.yaml $HELM_PLUGIN_DIR
|
|
|
|
- name: Check out
|
|
uses: actions/checkout@v1
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Test
|
|
run: |
|
|
make lint
|
|
make kubeval
|
|
make test
|