github: run unit tests on Fedora and force dnf
Run unit tests in GitHub workflows in a Fedora container to enable the dnf-json tests. Run the tests alone with the `force-dnf` flag to make sure the tests pass and are not skipped. Install Go using dnf instead of the GH action. The action seems to cause issues with the $PATH. Use the registry.fedoraproject.org container for both unit tests and pylint on dnf-json. Requires some reordering of the steps in each workflow and the addition of `git-core` as a dependency. Using Fedora 35 instead of latest because of changes in the go build tool: The new -buildvcs flag causes issues on GitHub actions.
This commit is contained in:
parent
5a01d6b339
commit
8070321169
1 changed files with 20 additions and 15 deletions
35
.github/workflows/tests.yml
vendored
35
.github/workflows/tests.yml
vendored
|
|
@ -14,26 +14,26 @@ jobs:
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: "🛃 Unit tests"
|
name: "🛃 Unit tests"
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
container:
|
||||||
|
image: registry.fedoraproject.org/fedora:35
|
||||||
|
|
||||||
- name: Set up Go 1.16
|
steps:
|
||||||
uses: actions/setup-go@v3
|
# krb5-devel is needed to test internal/upload/koji package
|
||||||
with:
|
# gcc is needed to build the mock dnf-json binary for the unit tests
|
||||||
go-version: 1.16
|
- name: Install build and test dependencies
|
||||||
id: go
|
run: dnf -y install krb5-devel gcc git-core go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
# This is needed to test internal/upload/koji package
|
|
||||||
- name: Install kerberos devel package
|
|
||||||
run: sudo apt-get install -y libkrb5-dev
|
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./...
|
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./...
|
||||||
|
|
||||||
|
- name: Run dnfjson tests with force-dnf to make sure it's not skipped for any reason
|
||||||
|
run: go test -race ./internal/dnfjson/... -force-dnf
|
||||||
|
|
||||||
- name: Send coverage to codecov.io
|
- name: Send coverage to codecov.io
|
||||||
run: bash <(curl -s https://codecov.io/bash)
|
run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
|
@ -41,12 +41,17 @@ jobs:
|
||||||
name: "🐍 Lint (dnf-json)"
|
name: "🐍 Lint (dnf-json)"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: docker.io/library/fedora:35
|
image: registry.fedoraproject.org/fedora:35
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
|
||||||
- name: Install dependencies
|
- name: Install build and test dependencies
|
||||||
run: |
|
run: dnf -y install python3-pylint git-core
|
||||||
dnf -y install python3-pylint
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Analysing the code with pylint
|
- name: Analysing the code with pylint
|
||||||
run: |
|
run: |
|
||||||
python3 -m pylint dnf-json
|
python3 -m pylint dnf-json
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue