mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 02:16:28 +02:00
232 lines
6 KiB
YAML
232 lines
6 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
name: Test
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.x]
|
|
platform: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: set env vars
|
|
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: cache go binaries
|
|
uses: actions/cache@v2
|
|
id: cache-go-bin
|
|
with:
|
|
path: ~/go/bin
|
|
key: ${{ runner.os }}-${{ hashFiles('**/go.mod') }}
|
|
restore-keys: ${{ runner.os }}-go-bin
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-go-
|
|
- run: make deps-build
|
|
- name: Lint
|
|
if: runner.os == 'Linux'
|
|
run: make lint
|
|
- name: spellcheck
|
|
if: runner.os == 'Linux'
|
|
run: make spellcheck
|
|
- name: test
|
|
if: runner.os != 'Linux'
|
|
run: make test
|
|
|
|
cover:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16.x
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: set env vars
|
|
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
|
|
- name: cache go binaries
|
|
uses: actions/cache@v2
|
|
id: cache-go-bin
|
|
with:
|
|
path: ~/go/bin
|
|
key: ${{ runner.os }}-${{ hashFiles('**/go.mod') }}
|
|
restore-keys: ${{ runner.os }}-go-bin
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: ${{ runner.os }}-go-
|
|
|
|
- name: cover
|
|
run: make cover
|
|
|
|
- uses: jandelgado/gcov2lcov-action@v1.0.8
|
|
name: convert coverage to lcov
|
|
with:
|
|
infile: coverage.txt
|
|
outfile: coverage.lcov
|
|
|
|
- name: upload to coveralls
|
|
uses: coverallsapp/github-action@v1.1.2
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
path-to-lcov: coverage.lcov
|
|
|
|
integration:
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.x]
|
|
platform: [ubuntu-latest]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: set env vars
|
|
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
- name: install mkcert
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
#!/bin/bash
|
|
if [ ! -f mkcert ]; then
|
|
echo "downloading mkcert"
|
|
sudo curl -Lo mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.1/mkcert-v1.4.1-linux-amd64
|
|
sudo chmod +x mkcert
|
|
fi
|
|
sudo install mkcert /usr/local/bin/
|
|
- name: Create kind cluster
|
|
uses: helm/kind-action@v1.2.0
|
|
with:
|
|
cluster_name: kind
|
|
|
|
- name: build dev docker image
|
|
run: |
|
|
./scripts/build-dev-docker.bash
|
|
|
|
- name: integration tests
|
|
run: go test -v ./integration/...
|
|
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.x]
|
|
platform: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
~/Library/Caches/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: build
|
|
run: |
|
|
make build-deps
|
|
make build
|
|
make build NAME=pomerium-cli
|
|
|
|
- name: save binary
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
path: bin/pomerium*
|
|
name: pomerium ${{ github.run_id }} ${{ matrix.platform }}
|
|
retention-days: 1
|
|
|
|
build-docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: build
|
|
run: docker build .
|
|
|
|
precommit:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16.x
|
|
- uses: actions/setup-python@v2
|
|
- uses: pre-commit/action@release
|
|
with:
|
|
extra_args: --show-diff-on-failure --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
|
|
env:
|
|
SKIP: lint
|
|
|
|
license:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
go-version: [1.16.x]
|
|
platform: [ubuntu-latest]
|
|
needs:
|
|
- build
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16.x
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install lichen
|
|
run: $(cd /tmp; go get github.com/uw-labs/lichen)
|
|
|
|
- name: retrieve binary
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: pomerium ${{ github.run_id }} ${{ matrix.platform }}
|
|
path: bin/
|
|
|
|
- name: golang license check
|
|
run: |
|
|
chmod 755 bin/pomerium bin/pomerium-cli
|
|
lichen --config lichen.yaml bin/pomerium*
|