Skip to content

Commit

Permalink
More adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer committed Oct 11, 2024
1 parent b353730 commit 39f5cc8
Show file tree
Hide file tree
Showing 32 changed files with 852 additions and 575 deletions.
128 changes: 88 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,65 @@
name: Continuous Integration
on:
push:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BIFROEST_VENDOR: "Engity GmbH"

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
test:
name: Tests
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
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
cache-dependency-path: |
go.sum

- 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
Expand All @@ -32,12 +69,17 @@ jobs:
with:
fetch-depth: 0

- name: Cache
- 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: |
.cache
~/go/pkg/mod
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand All @@ -62,50 +104,45 @@ jobs:
goveralls "-coverprofile=profile.cov" "-service=github" "-parallel" "-flagname=go-${{ matrix.os }}"
package:
name: Package
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
needs: [ evaluate ]
runs-on: "ubuntu-latest"
container:
image: ghcr.io/engity-com/build-images/go
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache-dependency-path: |
go.sum
- 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: Cache
- name: Cache Go
uses: actions/cache@v4
with:
path: |
.cache
~/go/pkg/mod
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 --log.colorMode=always
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BIFROEST_VENDOR: engity
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
Expand All @@ -115,6 +152,7 @@ jobs:
doc:
name: Documentation
needs: [ evaluate ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -128,7 +166,8 @@ jobs:
with:
python-version: 3.x

- uses: actions/cache@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ hashFiles('docs/requirements.txt') }}
Expand All @@ -142,7 +181,16 @@ jobs:
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 --project-name=bifroest-engity-org var/doc
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"
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Lint
on:
push:

pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

permissions:
contents: read
Expand All @@ -20,14 +20,15 @@ jobs:
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
cache-dependency-path: |
go.sum

- name: Install Ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
90 changes: 0 additions & 90 deletions .github/workflows/pr-publish.yaml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/pr-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Pull-Requests Updates

env:
GITHUB_TOKEN: ${{ github.token }}

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{github.event.number}}

on:
pull_request:
types:
- labeled
- unlabeled
- closed

jobs:
build:
runs-on: ubuntu-latest
name: Inspect
if: github.event_name == 'pull_request'
permissions:
pull-requests: read
actions: write
packages: write

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: |
set -ex
go run ./cmd/build inspect-pr-action --log.colorMode=always "${{github.event.action}}" "${{github.event.label.name}}"
Loading

0 comments on commit 39f5cc8

Please sign in to comment.