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

CI: test integration to osbuild-composer as part of PRs #419

Merged
merged 1 commit into from
Feb 6, 2024
Merged
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
101 changes: 101 additions & 0 deletions .github/workflows/test-osbuild-composer-intergation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "[osbuild-composer integration]"

on:
pull_request:
branches:
- "*"

jobs:
unit-tests:
name: "🛃 Unit tests"
runs-on: ubuntu-20.04
container:
image: registry.fedoraproject.org/fedora:latest

steps:
# krb5-devel is needed to test internal/upload/koji package
# gcc is needed to build the mock depsolver binary for the unit tests
# gpgme-devel is needed for container upload dependencies
- name: Install build and test dependencies
run: dnf -y install krb5-devel gcc git-core go gpgme-devel osbuild-depsolve-dnf btrfs-progs-devel device-mapper-devel

- name: Check out osbuild-composer main branch
uses: actions/checkout@v4
with:
path: osbuild-composer
repository: osbuild/osbuild-composer
ref: main

- name: Check out the osbuild/images code
uses: actions/checkout@v4
with:
path: images
ref: ${{ github.event.pull_request.head.sha }}

- name: Update the osbuild/images reference
run: |
cd osbuild-composer
go mod edit -replace github.com/osbuild/images=../images
./tools/prepare-source.sh

- name: Mark the working directory as safe for git
run: git config --global --add safe.directory "$(pwd)"

- name: Run unit tests
working-directory: osbuild-composer
run: go test -race ./...

lint:
name: "⌨ Golang Lint"
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
go-version: 1.19
id: go

- name: Check out osbuild-composer main branch
uses: actions/checkout@v4
with:
path: osbuild-composer
repository: osbuild/osbuild-composer
ref: main

- name: Check out the osbuild/images code
uses: actions/checkout@v4
with:
path: images
ref: ${{ github.event.pull_request.head.sha }}

- name: Update the osbuild/images reference
working-directory: osbuild-composer
run: |
go mod edit -replace github.com/osbuild/images=../images
./tools/prepare-source.sh

- name: Allow replacing the osbuild/images module in .golangci.yml
working-directory: osbuild-composer
run: |
awk '/replace-local: false/ {print " replace-local: true"; print " replace-allow-list:\n - github.com/osbuild/images"; next} 1' .golangci.yml > .golangci.yml.new
mv .golangci.yml.new .golangci.yml

- name: Apt update
run: sudo apt update

# This is needed to lint internal/upload/koji package
- name: Install kerberos devel package
run: sudo apt install -y libkrb5-dev

# This is needed for the container upload dependencies
- name: Install libgpgme devel package
run: sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
working-directory: osbuild-composer
args: --verbose --timeout 5m0s
# Needed due to https://github.com/golangci/golangci-lint-action/issues/135
skip-pkg-cache: true
Loading