Skip to content

Align with EJBCA & SignServer template repo #80

Align with EJBCA & SignServer template repo

Align with EJBCA & SignServer template repo #80

Workflow file for this run

name: test
on: [workflow_dispatch, push, pull_request]
jobs:
build:
name: Build and Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
# Setup GoLang build environment
# https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
cache: true
# Download dependencies
- run: go mod download
# Build Go binary
- run: go build -v .
# Run Go linters
# https://github.com/golangci/golangci-lint-action
- name: Run linters
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: latest
test:
name: Go Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
# Setup GoLang build environment
# https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
cache: true
# Download dependencies
- run: go mod download
# Place the contents of ${{ secrets.EJBCA_CLIENT_CERT_PATH }} into a file at /tmp/certs/ejbca.pem
- run: mkdir -p /tmp/certs && echo "${{ secrets.EJBCA_CLIENT_CERT }}" > /tmp/certs/ejbca.pem
# Place the contents of ${{ secrets.EJBCA_CA_CERT_PATH }} into a file at /tmp/certs/ejbca-ca.pem
- run: mkdir -p /tmp/certs && echo "${{ secrets.EJBCA_CA_CERT }}" > /tmp/certs/ejbca-ca.pem
# Run Go tests
- name: Run go test
run: go test -v ./...
env:
EJBCA_CLIENT_CERT_PATH: /tmp/certs/ejbca.pem
EJBCA_CA_CERT_PATH: /tmp/certs/ejbca-ca.pem
EJBCA_CA_NAME: ${{ vars.EJBCA_CA_NAME }}
EJBCA_HOSTNAME: ${{ secrets.EJBCA_HOSTNAME }}
EJBCA_CERTIFICATE_PROFILE_NAME: ${{ vars.EJBCA_CERTIFICATE_PROFILE_NAME }}
EJBCA_CSR_SUBJECT: ${{ vars.EJBCA_CSR_SUBJECT }}
EJBCA_END_ENTITY_PROFILE_NAME: ${{ vars.EJBCA_END_ENTITY_PROFILE_NAME }}
EJBCA_EST_ALIAS: ${{ vars.EJBCA_EST_ALIAS }}
EJBCA_EST_PASSWORD: ${{ secrets.EJBCA_EST_PASSWORD }}
EJBCA_EST_USERNAME: ${{ secrets.EJBCA_EST_USERNAME }}