2021-08-30 18:21:15 +00:00
|
|
|
name: authentik-ci-outpost
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-09-03 08:53:39 +00:00
|
|
|
branches:
|
2022-06-03 17:40:09 +00:00
|
|
|
- main
|
2021-09-03 08:53:39 +00:00
|
|
|
- next
|
|
|
|
- version-*
|
|
|
|
pull_request:
|
2021-09-07 08:06:30 +00:00
|
|
|
branches:
|
2022-06-03 17:40:09 +00:00
|
|
|
- main
|
2023-11-03 14:46:00 +00:00
|
|
|
- version-*
|
2021-08-30 18:21:15 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint-golint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 04:42:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-03-16 09:44:18 +00:00
|
|
|
- uses: actions/setup-go@v4
|
2021-08-30 18:21:15 +00:00
|
|
|
with:
|
2023-04-21 10:54:23 +00:00
|
|
|
go-version-file: "go.mod"
|
2022-05-08 14:50:58 +00:00
|
|
|
- name: Prepare and generate API
|
2021-08-30 18:21:15 +00:00
|
|
|
run: |
|
|
|
|
# Create folder structure for go embeds
|
|
|
|
mkdir -p web/dist
|
|
|
|
mkdir -p website/help
|
|
|
|
touch web/dist/test website/help/test
|
2022-05-08 14:50:58 +00:00
|
|
|
- name: Generate API
|
|
|
|
run: make gen-client-go
|
2022-05-08 14:48:53 +00:00
|
|
|
- name: golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
2023-01-19 17:17:18 +00:00
|
|
|
with:
|
2023-10-09 17:20:02 +00:00
|
|
|
version: v1.54.2
|
2023-06-02 06:32:24 +00:00
|
|
|
args: --timeout 5000s --verbose
|
2023-04-21 13:34:34 +00:00
|
|
|
skip-cache: true
|
2022-01-24 19:12:25 +00:00
|
|
|
test-unittest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 04:42:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-03-16 09:44:18 +00:00
|
|
|
- uses: actions/setup-go@v4
|
2022-01-24 19:12:25 +00:00
|
|
|
with:
|
2023-04-21 10:54:23 +00:00
|
|
|
go-version-file: "go.mod"
|
2023-09-26 16:56:37 +00:00
|
|
|
- name: Setup authentik env
|
|
|
|
uses: ./.github/actions/setup
|
2022-05-08 14:50:58 +00:00
|
|
|
- name: Generate API
|
|
|
|
run: make gen-client-go
|
2022-01-24 19:12:25 +00:00
|
|
|
- name: Go unittests
|
|
|
|
run: |
|
2022-04-04 09:28:57 +00:00
|
|
|
go test -timeout 0 -v -race -coverprofile=coverage.out -covermode=atomic -cover ./...
|
2021-12-08 20:00:58 +00:00
|
|
|
ci-outpost-mark:
|
|
|
|
needs:
|
|
|
|
- lint-golint
|
2022-01-24 19:12:25 +00:00
|
|
|
- test-unittest
|
2021-12-08 20:00:58 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- run: echo mark
|
2023-02-09 19:19:48 +00:00
|
|
|
build-container:
|
2021-11-10 08:31:56 +00:00
|
|
|
timeout-minutes: 120
|
2021-08-30 18:21:15 +00:00
|
|
|
needs:
|
2021-12-08 20:00:58 +00:00
|
|
|
- ci-outpost-mark
|
2021-08-30 18:21:15 +00:00
|
|
|
strategy:
|
2021-11-21 22:44:09 +00:00
|
|
|
fail-fast: false
|
2021-08-30 18:21:15 +00:00
|
|
|
matrix:
|
|
|
|
type:
|
|
|
|
- proxy
|
|
|
|
- ldap
|
2023-03-20 15:54:35 +00:00
|
|
|
- radius
|
2021-08-30 18:21:15 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-11-03 14:46:00 +00:00
|
|
|
permissions:
|
2023-11-18 23:31:20 +00:00
|
|
|
# Needed to upload contianer images to ghcr.io
|
2023-11-03 14:46:00 +00:00
|
|
|
packages: write
|
2021-08-30 18:21:15 +00:00
|
|
|
steps:
|
2023-09-05 04:42:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-21 13:14:31 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2021-11-21 22:35:23 +00:00
|
|
|
- name: Set up QEMU
|
2023-09-13 10:10:39 +00:00
|
|
|
uses: docker/setup-qemu-action@v3.0.0
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: Set up Docker Buildx
|
2023-09-13 10:24:37 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare variables
|
2022-06-21 21:31:27 +00:00
|
|
|
uses: ./.github/actions/docker-push-variables
|
2021-08-30 18:21:15 +00:00
|
|
|
id: ev
|
2021-09-03 08:53:39 +00:00
|
|
|
env:
|
2021-12-18 16:01:51 +00:00
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
2021-09-01 13:03:27 +00:00
|
|
|
- name: Login to Container Registry
|
2023-09-13 10:17:18 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-09-03 08:57:44 +00:00
|
|
|
if: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 18:21:15 +00:00
|
|
|
with:
|
2021-10-11 12:08:34 +00:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-05-08 14:50:58 +00:00
|
|
|
- name: Generate API
|
|
|
|
run: make gen-client-go
|
2023-01-11 16:15:19 +00:00
|
|
|
- name: Build Docker Image
|
2023-09-13 10:16:12 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2021-08-30 18:21:15 +00:00
|
|
|
with:
|
2021-09-03 08:57:44 +00:00
|
|
|
push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 18:21:15 +00:00
|
|
|
tags: |
|
2021-10-11 12:08:34 +00:00
|
|
|
ghcr.io/goauthentik/dev-${{ matrix.type }}:gh-${{ steps.ev.outputs.branchNameContainer }}
|
|
|
|
ghcr.io/goauthentik/dev-${{ matrix.type }}:gh-${{ steps.ev.outputs.sha }}
|
2021-08-30 18:21:15 +00:00
|
|
|
file: ${{ matrix.type }}.Dockerfile
|
|
|
|
build-args: |
|
2021-09-01 14:19:29 +00:00
|
|
|
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
|
2023-06-23 22:10:27 +00:00
|
|
|
VERSION=${{ steps.ev.outputs.version }}
|
2022-06-21 21:31:27 +00:00
|
|
|
VERSION_FAMILY=${{ steps.ev.outputs.versionFamily }}
|
2023-04-21 10:36:35 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-02-09 19:19:48 +00:00
|
|
|
context: .
|
2023-04-21 13:09:26 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2023-02-09 19:19:48 +00:00
|
|
|
build-binary:
|
2021-12-17 19:49:32 +00:00
|
|
|
timeout-minutes: 120
|
|
|
|
needs:
|
|
|
|
- ci-outpost-mark
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
type:
|
|
|
|
- proxy
|
|
|
|
- ldap
|
2023-03-20 15:54:35 +00:00
|
|
|
- radius
|
2021-12-17 19:49:32 +00:00
|
|
|
goos: [linux]
|
|
|
|
goarch: [amd64, arm64]
|
|
|
|
steps:
|
2023-09-05 04:42:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-21 13:14:31 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2023-03-16 09:44:18 +00:00
|
|
|
- uses: actions/setup-go@v4
|
2021-12-17 19:49:32 +00:00
|
|
|
with:
|
2023-04-21 10:54:23 +00:00
|
|
|
go-version-file: "go.mod"
|
2023-10-24 09:44:27 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2021-12-17 19:49:32 +00:00
|
|
|
with:
|
2023-11-18 23:33:37 +00:00
|
|
|
node-version-file: web/package.json
|
2023-03-20 15:54:35 +00:00
|
|
|
cache: "npm"
|
2021-12-17 19:49:32 +00:00
|
|
|
cache-dependency-path: web/package-lock.json
|
2022-05-08 14:50:58 +00:00
|
|
|
- name: Generate API
|
|
|
|
run: make gen-client-go
|
2021-12-17 19:49:32 +00:00
|
|
|
- name: Build web
|
2022-05-09 19:22:41 +00:00
|
|
|
working-directory: web/
|
2021-12-17 19:49:32 +00:00
|
|
|
run: |
|
2022-04-14 20:30:44 +00:00
|
|
|
npm ci
|
2021-12-17 19:49:32 +00:00
|
|
|
npm run build-proxy
|
|
|
|
- name: Build outpost
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
export GOOS=${{ matrix.goos }}
|
|
|
|
export GOARCH=${{ matrix.goarch }}
|
2023-05-31 14:48:14 +00:00
|
|
|
export CGO_ENABLED=0
|
2021-12-17 19:49:32 +00:00
|
|
|
go build -tags=outpost_static_embed -v -o ./authentik-outpost-${{ matrix.type }}_${{ matrix.goos }}_${{ matrix.goarch }} ./cmd/${{ matrix.type }}
|