Skip to content

#11 Docker Environment #184

#11 Docker Environment

#11 Docker Environment #184

Workflow file for this run

name: Continuous Integration
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BIFROEST_VENDOR: "Engity GmbH"
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
evaluate:
name: Evaluate
runs-on: ubuntu-latest
outputs:
commit: "${{ steps.refs.outputs.commit }}"
version: "${{ steps.refs.outputs.version }}"
ref: "${{ steps.refs.outputs.ref }}"
pr: "${{ steps.refs.outputs.pr }}"
stage-binary: "${{ steps.refs.outputs.stage-binary }}"
stage-archive: "${{ steps.refs.outputs.stage-archive }}"
stage-image: "${{ steps.refs.outputs.stage-image }}"
stage-digest: "${{ steps.refs.outputs.stage-digest }}"
stage-publish: "${{ steps.refs.outputs.stage-publish }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
cache: false
go-version-file: go.mod
check-latest: true
- name: Cache Go
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Execute
id: refs
run: |
go run ./cmd/build evaluate-environment --log.colorMode=always
test:
name: Tests
needs: [ evaluate ]
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install libpam0g-dev
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
cache: false
go-version-file: go.mod
check-latest: true
- name: Cache Go
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Install dependencies
run: |
go mod download
- name: Test
run: |
mkdir -p var
go test -v -covermode atomic "-coverprofile=var/profile.cov" ./...
- name: Send coverage
if: false
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
goveralls "-coverprofile=profile.cov" "-service=github" "-parallel" "-flagname=go-${{ matrix.os }}"
package:
name: Package
needs: [ evaluate ]
runs-on: "ubuntu-latest"
container:
image: ghcr.io/engity-com/build-images/go
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Go
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache images dependencies
uses: actions/cache@v4
with:
path: .cache/dependencies/images
key: images-dependencies
restore-keys: images-dependencies
- name: Git configure
run: |
git config --global --add safe.directory $(pwd)
- name: Install dependencies
run: |
go mod download
- name: Build
run: |
go run ./cmd/build build --log.colorMode=always
- name: Archive package results
if: needs.evaluate.outputs.stage-publish == 'true'
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: dist
path: |
var/dist/**/*
doc:
name: Documentation
needs: [ evaluate ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ hashFiles('docs/requirements.txt') }}
- name: Install dependencies
run: |
pip install -r docs/requirements.txt
- name: Build
run: |
mkdocs --color build -c
- name: Deploy
id: deploy
if: needs.evaluate.outputs.stage-publish == 'true'
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: pages deploy --branch=${{ needs.evaluate.outputs.version }} --commit-dirty=true --project-name=bifroest-engity-org var/doc
- name: Report
if: needs.evaluate.outputs.stage-publish == 'true'
env:
DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
run: |
echo "Documentation is available at ${DEPLOYMENT_URL}" >> "$GITHUB_STEP_SUMMARY"