This repository has been archived on 2022-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
dex/.github/workflows/ci.yml

110 lines
3.2 KiB
YAML
Raw Normal View History

2019-12-06 21:19:30 +05:30
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-16.04
env:
2019-12-09 01:11:28 +05:30
GOFLAGS: -mod=readonly
2019-12-06 21:19:30 +05:30
services:
postgres:
image: postgres:10.8
ports:
- 5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dex
ports:
- 3306:3306
options: --health-cmd "mysql -proot -e \"show databases;\"" --health-interval 10s --health-timeout 5s --health-retries 5
2019-12-06 21:19:30 +05:30
etcd:
image: gcr.io/etcd-development/etcd:v3.2.9
ports:
- 2379
env:
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
options: --health-cmd "ETCDCTL_API=3 etcdctl --endpoints http://localhost:2379 endpoint health" --health-interval 10s --health-timeout 5s --health-retries 5
keystone:
image: openio/openstack-keystone:pike
ports:
- 5000
- 35357
options: --health-cmd "curl --fail http://localhost:5000/v3" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
2020-07-01 17:32:01 +05:30
go-version: 1.14
2019-12-06 21:19:30 +05:30
- name: Checkout code
2020-02-21 20:23:13 +05:30
uses: actions/checkout@v2
2019-12-06 21:19:30 +05:30
- name: Run tests
run: make testall
env:
DEX_FOO_USER_PASSWORD: $2a$10$33EMT0cVYVlPy6WAMCLsceLYjWhuHpbz5yuZxu/GAFj03J9Lytjuy
2019-12-06 21:19:30 +05:30
DEX_MYSQL_DATABASE: dex
DEX_MYSQL_USER: root
DEX_MYSQL_PASSWORD: root
DEX_MYSQL_HOST: 127.0.0.1
DEX_MYSQL_PORT: 3306
DEX_POSTGRES_DATABASE: postgres
DEX_POSTGRES_USER: postgres
DEX_POSTGRES_PASSWORD: postgres
DEX_POSTGRES_HOST: localhost
DEX_POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
DEX_ETCD_ENDPOINTS: http://localhost:${{ job.services.etcd.ports[2379] }}
2019-12-09 00:52:09 +05:30
DEX_LDAP_TESTS: 1
2019-12-06 21:19:30 +05:30
DEX_KEYSTONE_URL: http://localhost:${{ job.services.keystone.ports[5000] }}
DEX_KEYSTONE_ADMIN_URL: http://localhost:${{ job.services.keystone.ports[35357] }}
DEX_KEYSTONE_ADMIN_USER: demo
DEX_KEYSTONE_ADMIN_PASS: DEMO_PASS
2019-12-18 19:25:52 +05:30
- name: Run linter
run: make lint
2019-12-06 21:19:30 +05:30
# Ensure proto generation doesn't depend on external packages.
- name: Verify proto
run: make verify-proto
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Determine tag
uses: haya14busa/action-cond@v1
id: imagetag
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.sha }}
if_false: "master"
- name: Build
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: dexidp/dex
tags: ${{ steps.imagetag.outputs.value }}
add_git_labels: true
push: ${{ github.event_name == 'push' }}