debian-forge-composer/.github/workflows/tests.yml
Tom Gundersen e8e5a11389 github-action: run unit tests
There should be no need to run unit tests on specific architectures,
move it over to github-actions and rename "Lint" to "Checks" as it
is a bit more generic now.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2020-03-10 23:38:03 +01:00

88 lines
2.3 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.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Check that source has been prepared
run: |
./tools/prepare-source.sh
if ! git diff --quiet --exit-code ; then
echo
echo "Please include these changes in your branch: "
git diff
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 ./...
rpm_build:
name: "📦 RPM"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fedora_release: ["31", "32", "rawhide"]
container:
image: "docker.io/library/fedora:${{ matrix.fedora_release }}"
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: "🛒 Install RPM build dependencies"
run: dnf -y builddep golang-github-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)