pomerium/.github/workflows/test.yaml
Caleb Doxsey d5b4910951
core/ci: check docker base images (#4906)
* check docker base images

* test bad image

* debugging

* fix missing gcr image

* restore hash

* fix docker tag

* improved check

* fix variable

* fix check
2024-01-12 12:25:28 -07:00

149 lines
4.3 KiB
YAML

name: Test
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
jobs:
integration:
strategy:
fail-fast: false
matrix:
go-version: [1.21.x]
node-version: [16.x]
platform: [ubuntu-latest]
deployment: [multi, single]
authenticate-flow: [stateful, stateless]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: ${{ matrix.go-version }}
cache: false
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: ui/yarn.lock
- name: set env vars
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: build dev docker image
run: |
./scripts/build-dev-docker.bash
- name: start cluster
run: |
export POMERIUM_TAG=dev
cd ./integration/clusters/${{matrix.deployment}}-${{matrix.authenticate-flow}}
docker-compose up -d
- name: integration tests
run: |
(cd ./integration/clusters/${{matrix.deployment}}-${{matrix.authenticate-flow}} && docker-compose logs -f &)
go test -v ./integration/...
build:
strategy:
matrix:
go-version: [1.21.x]
node-version: [16.x]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: ${{ matrix.go-version }}
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: ui/yarn.lock
- name: build
run: |
make build-deps
make build
- name: save binary
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
with:
path: bin/pomerium*
name: pomerium ${{ github.run_id }} ${{ matrix.platform }}
retention-days: 1
- name: test
run: make cover
- uses: jandelgado/gcov2lcov-action@c680c0f7c7442485f1749eb2a13e54a686e76eb5
if: matrix.platform == 'ubuntu-latest'
name: convert coverage to lcov
with:
infile: coverage.txt
outfile: coverage.lcov
- name: upload to coveralls
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
if: matrix.platform == 'ubuntu-latest'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
- name: Docker Build
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
with:
context: .
file: ./Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max
precommit:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
fetch-depth: 0
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: 1.21.x
cache: false
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
with:
python-version: "3.x"
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
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
check-docker-images:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- run: ./scripts/check-docker-images