The go test coverage report does not cover other packages unless you list them with the -coverpkg= argument. This results in an incomplete coverage report with oddly missing lines. This commit lists all of the packages so that they will all be included when running the tests and gathering the results.
189 lines
5.5 KiB
YAML
189 lines
5.5 KiB
YAML
name: Tests
|
|
|
|
# NOTE(mhayden): Restricting branches prevents jobs from being doubled since
|
|
# a push to a pull request triggers two events.
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
lint:
|
|
name: "🛃 Checks"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Set up Go 1.12
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.12
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Check that source has been prepared
|
|
run: |
|
|
./tools/prepare-source.sh
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
echo
|
|
echo "Please include these changes in your branch: "
|
|
git status -vv
|
|
exit "1"
|
|
else
|
|
exit "0"
|
|
fi
|
|
|
|
- name: Install golangci-lint
|
|
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.23.7
|
|
|
|
- name: Run golangci-lint
|
|
run: $(go env GOPATH)/bin/golangci-lint run
|
|
|
|
- name: Run unit tests
|
|
run: go test -v -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./...
|
|
|
|
- name: Send coverage to codecov.io
|
|
run: bash <(curl -s https://codecov.io/bash)
|
|
|
|
old_rpm_build:
|
|
name: "📦 RPM (golang-github-osbuild-composer)"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
fedora_release: ["31"]
|
|
container:
|
|
image: "quay.io/osbuild/osbuild-fedora${{ matrix.fedora_release }}:latest"
|
|
steps:
|
|
- name: "📥 Prepare container"
|
|
run: |
|
|
echo "fastestmirror=1" >> /etc/dnf/dnf.conf
|
|
echo "install_weak_deps=0" >> /etc/dnf/dnf.conf
|
|
rm -fv /etc/yum.repos.d/fedora*modular*
|
|
dnf -y upgrade
|
|
dnf -y install dnf-plugins-core findutils git make rpm-build rpmdevtools
|
|
|
|
- name: "🗄️ Clone the repository"
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "🧱 Pre-install osbuild from updates-testing repo"
|
|
run: dnf -y --enablerepo=updates-testing install osbuild
|
|
|
|
- name: "🛒 Install RPM build dependencies"
|
|
run: dnf -y builddep golang-github-osbuild-composer.spec
|
|
|
|
- name: "🛠️ Build RPMs"
|
|
run: |
|
|
mkdir rpms
|
|
make old-srpm
|
|
cp -av rpmbuild/SRPMS/*.rpm rpms/
|
|
make old-rpm
|
|
cp -av rpmbuild/RPMS/*/*.rpm rpms/
|
|
|
|
- name: "📤 Upload artifacts"
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: rpms
|
|
path: rpms/
|
|
|
|
- name: "🔎 Test RPM installation"
|
|
run: dnf -y install $(ls rpms/*.x86_64.rpm)
|
|
|
|
rpm_build:
|
|
name: "📦 RPM (osbuild-composer)"
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
fedora_release: ["32", "33"]
|
|
container:
|
|
image: "quay.io/osbuild/osbuild-fedora${{ matrix.fedora_release }}:latest"
|
|
steps:
|
|
- name: "📥 Prepare container"
|
|
run: |
|
|
echo "fastestmirror=1" >> /etc/dnf/dnf.conf
|
|
echo "install_weak_deps=0" >> /etc/dnf/dnf.conf
|
|
rm -fv /etc/yum.repos.d/fedora*modular*
|
|
dnf -y upgrade
|
|
dnf -y install dnf-plugins-core findutils git make rpm-build rpmdevtools
|
|
|
|
- name: "🗄️ Clone the repository"
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "🧱 Pre-install osbuild from updates-testing repo"
|
|
run: dnf -y --enablerepo=updates-testing install osbuild
|
|
|
|
- name: "🛒 Install RPM build dependencies"
|
|
run: dnf -y builddep osbuild-composer.spec
|
|
|
|
- name: "🛠️ Build RPMs"
|
|
run: |
|
|
mkdir rpms
|
|
make srpm
|
|
cp -av rpmbuild/SRPMS/*.rpm rpms/
|
|
make rpm
|
|
cp -av rpmbuild/RPMS/*/*.rpm rpms/
|
|
|
|
- name: "📤 Upload artifacts"
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: rpms
|
|
path: rpms/
|
|
|
|
- name: "🔎 Test RPM installation"
|
|
run: dnf -y install $(ls rpms/*.x86_64.rpm)
|
|
|
|
koji:
|
|
name: "麹 Koji test"
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: docker.io/library/postgres:12-alpine
|
|
env:
|
|
POSTGRES_USER: koji
|
|
POSTGRES_PASSWORD: kojipass
|
|
POSTGRES_DB: koji
|
|
koji:
|
|
image: quay.io/osbuild/ghci-koji:v1
|
|
env:
|
|
POSTGRES_USER: koji
|
|
POSTGRES_PASSWORD: kojipass
|
|
POSTGRES_DB: koji
|
|
POSTGRES_HOST: postgres
|
|
ports:
|
|
- 8080:80
|
|
steps:
|
|
- name: Set up Go 1.12
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.12
|
|
id: go
|
|
|
|
# We need python for koji client.
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
|
|
# Koji from pip is missing its config file.
|
|
# To fix this, the default Fedora 32 config is included in the repo
|
|
# and installed here. See the last line of the script.
|
|
- name: Install koji client
|
|
run: |
|
|
sudo apt-get install -y libkrb5-dev
|
|
python -m pip install --upgrade pip
|
|
pip install koji
|
|
sudo cp .github/koji.conf /etc/koji.conf
|
|
|
|
- name: Run unit tests
|
|
run: go test -v -race -covermode atomic -coverprofile=coverage.txt -tags koji_test ./internal/upload/koji
|
|
|
|
- name: Send coverage to codecov.io
|
|
run: bash <(curl -s https://codecov.io/bash)
|