Skip to content
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
48 changes: 42 additions & 6 deletions .github/workflows/testing-farm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run tests on Testing Farm
on:
push:
branches: [ master ]
pull_request_trigger:
pull_request_target:
types: [opened, synchronize, reopened]

jobs:
Expand All @@ -16,19 +16,37 @@ jobs:
statuses: write

steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
- name: Checkout repository
uses: actions/checkout@v4

with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Test init on Fedora VM
uses: sclorg/testing-farm-as-github-action@v4
uses: sclorg/testing-farm-as-github-action@main
with:
api_key: ${{ secrets.TESTING_FARM_API_TOKEN }}
compose: Fedora-Rawhide
tmt_path: "tmt"
tmt_plan_regex: "fedora-init"
pull_request_status_name: "Fedora init test"
update_pull_request_status: "true"
create_github_summary: "true"
update_pull_request_status: "true"
variables: "REPO_URL=${{ github.server_url }}/${{ github.repository }};PR_HEAD=${{ github.event.pull_request.head.sha }};"

test-upgrade:
runs-on: ubuntu-latest

Expand All @@ -38,11 +56,29 @@ jobs:
statuses: write

steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1

- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Test upgrade on Fedora VM
uses: sclorg/testing-farm-as-github-action@v4
uses: sclorg/testing-farm-as-github-action@main
with:
api_key: ${{ secrets.TESTING_FARM_API_TOKEN }}
compose: Fedora-Rawhide
Expand All @@ -51,4 +87,4 @@ jobs:
pull_request_status_name: "Fedora upgrade test"
update_pull_request_status: "true"
create_github_summary: "true"

variables: "REPO_URL=${{ github.server_url }}/${{ github.repository }};PR_HEAD=${{ github.event.pull_request.head.sha }};"
2 changes: 1 addition & 1 deletion tmt/plans/fedora-init.fmf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: /plans/fedora
name: /plans/fedora-init
summary: Run tests in a fedora virtual machine environment
discover:
how: fmf
Expand Down
14 changes: 9 additions & 5 deletions tmt/tests/container/sanity/init/init.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
# prep
git clone "$TESTING_FARM_GIT_URL" repo
git clone "$REPO_URL" repo
cd repo
git fetch origin "$TESTING_FARM_GIT_REF"
git fetch origin "$PR_HEAD"
git checkout FETCH_HEAD

grep -q systemd /proc/1/comm
echo "Return value CONTAINER: $?"

# setup
autoreconf -vfi
./configure --prefix=/usr
Expand All @@ -13,10 +16,11 @@ make
# initialization
./bin/postgresql-setup --init

# start postgresql
# start postgresql and check if it's running
PGDATA=/var/lib/pgsql/data
LOGFILE=/var/lib/pgsql/logfile
su - postgres -c "
/usr/bin/pg_ctl -D $PGDATA -l $LOGFILE start
pg_ctl -D $PGDATA status && echo \"PostgreSQL is running\" || { echo \"PostgreSQL is NOT running\"; exit 1; }
"

# check if it is running
pg_ctl -D $PGDATA status && echo "PostgreSQL is running" || { echo "PostgreSQL is NOT running"; exit 1; }
6 changes: 4 additions & 2 deletions tmt/tests/container/sanity/init/main.fmf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Check whether the machine is a container
summary: Postgresql-setup init test in a fedora rawhide container
require:
- make
- m4
Expand All @@ -11,7 +11,9 @@ require:
- automake
- autoconf-archive
- git
test: ./init.sh
framework: shell
duration: 10m
tag: container-init-fedora
contact: [email protected]
test: ./init.sh

5 changes: 3 additions & 2 deletions tmt/tests/virtual/sanity/init/init.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash
# prep
git clone "$TESTING_FARM_GIT_URL" repo
git clone "$REPO_URL" repo
cd repo
git fetch origin "$TESTING_FARM_GIT_REF"
git fetch origin "$PR_HEAD"
git checkout FETCH_HEAD
git log -1 --oneline

# setup
autoreconf -vfi
Expand Down
4 changes: 2 additions & 2 deletions tmt/tests/virtual/sanity/upgrade/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
# prep
git clone "$TESTING_FARM_GIT_URL" repo
git clone "$REPO_URL" repo
cd repo
git fetch origin "$TESTING_FARM_GIT_REF"
git fetch origin "$PR_HEAD"
git checkout FETCH_HEAD
echo "Fedora release:"
cat /etc/fedora-release
Expand Down
Loading