#12 Kubernetes Environment #255
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BIFROEST_VENDOR: "Engity GmbH" | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
jobs: | |
files-changed: | |
name: Detect file changes | |
runs-on: ubuntu-latest | |
outputs: | |
go: ${{ steps.changes.outputs.go }} | |
docs: ${{ steps.changes.outputs.docs }} | |
any: ${{ steps.changes.outputs.any }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for backend file changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: .github/filters.yml | |
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, files-changed ] | |
if: needs.files-changed.outputs.go == 'true' | |
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, files-changed ] | |
if: needs.files-changed.outputs.go == 'true' | |
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/**/* | |
documentation: | |
name: Documentation | |
needs: [ evaluate, files-changed ] | |
if: needs.files-changed.outputs.docs == 'true' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: true | |
- name: Create temp repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: true | |
path: var/doc | |
- name: Setup Git | |
working-directory: var/doc | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Engity Bot" | |
- name: Prepare temp repository | |
working-directory: var/doc | |
run: | | |
git branch -d temp-deploy || true | |
git switch --orphan temp-deploy | |
- 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 | |
rm -f var/doc/requirements.txt | |
- name: Deploy | |
if: needs.evaluate.outputs.stage-publish == 'true' && needs.evaluate.outputs.pr | |
working-directory: var/doc | |
run: | | |
git add -A | |
git commit -m "Release PR-${{ needs.evaluate.outputs.pr }}" | |
git push --delete origin "docs/pr-${{ needs.evaluate.outputs.pr }}" || true | |
git tag -d "docs/pr-${{ needs.evaluate.outputs.pr }}" || true | |
git tag -a "docs/pr-${{ needs.evaluate.outputs.pr }}" -m "Release PR-${{ needs.evaluate.outputs.pr }}" | |
git push origin "docs/pr-${{ needs.evaluate.outputs.pr }}" | |
echo "Documentation is available at https://bifroest.engity.org/pr-${{ needs.evaluate.outputs.pr }}/" >> "$GITHUB_STEP_SUMMARY" |