Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renovate Build process #21

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 101 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +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:
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 Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Install Ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install libpam0g-dev
Expand All @@ -29,7 +69,14 @@ 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: ~/go/pkg/mod
Expand All @@ -40,6 +87,10 @@ jobs:
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest

- name: Install dependencies
run: |
go mod download

- name: Test
run: |
mkdir -p var
Expand All @@ -53,55 +104,55 @@ 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: stable

- 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: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Install Syft
uses: anchore/sbom-action/[email protected]

- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
- name: Cache images dependencies
uses: actions/cache@v4
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean
env:
BIFROEST_VENDOR: engity
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/*.tgz*
var/dist/*.zip*
var/dist/**/*

doc:
name: Documentation
needs: [ evaluate ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -115,6 +166,12 @@ jobs:
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
Expand All @@ -124,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"
16 changes: 11 additions & 5 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 @@ -18,11 +18,17 @@ jobs:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
cache: false
go-version-file: go.mod
check-latest: true

- name: Install Ubuntu dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
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}}"
48 changes: 27 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Release"

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

on:
release:
types: [ published ]
Expand All @@ -14,45 +18,41 @@ jobs:
release:
name: "Release"
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: stable

- name: Install Ubuntu dependencies
run: sudo apt install libpam0g-dev

- name: Install Syft
uses: anchore/sbom-action/[email protected]

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache
- 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: Install dependencies
run: |
go mod download

- name: Test
run: |
mkdir -p var
go test -v ./...

- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BIFROEST_VENDOR: engity
- name: Build/Release
run: |
go run ./cmd/build build --log.colorMode=always

documentation:
name: "Documentation"
Expand All @@ -73,6 +73,12 @@ jobs:
run: |
pip install -r docs/requirements.txt

- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ hashFiles('docs/requirements.txt') }}

- name: Setup Git
run: |
git config user.email "[email protected]"
Expand Down
Loading
Loading