-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (71 loc) · 2.88 KB
/
test_unit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
# This is a basic workflow to help you get started with Actions
name: Test (unit)
# Controls when the action will run.
on: # yamllint disable-line rule:truthy
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Checks-out the gimme-a-man repo
- uses: actions/checkout@v2
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: mbideau/gimme-a-man
# Relative path under $GITHUB_WORKSPACE to place the repository
path: gimme-a-man
# Checks-out the shunit2 repo
- uses: actions/checkout@v2
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: kward/shunit2
# Relative path under $GITHUB_WORKSPACE to place the repository
path: shunit2
# Install required packages dependencies
- name: Install required packages dependencies
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get -q -y install \
btrfs-progs git make gettext grep gzip tar sed mawk coreutils \
whiptail
# Build the program
- name: Building the program
run: GIMME_A_MAN="$(pwd)"/gimme-a-man/gimme_a_man.sh make
# Create a BTRFS file
- name: Creating an image file with a BTRFS filesystem
run: rm -f test.img && truncate -s 150M test.img && sudo mkfs.btrfs -f test.img
# Unmount (preventive)
- name: Unmounting the BTRFS image file (preventive)
run: if LC_ALL=C mount | grep -q ' on .*test\.mnt'; then sudo umount -v test.mnt; fi
# Mount it
- name: Mouting the BTRFS image file
run: |
sudo rm -fr test.mnt && sudo mkdir test.mnt && \
sudo mount -v -t btrfs -o loop test.img test.mnt
# Running the tests
- name: Running the tests
run: |
TMPDIR="$(pwd)"/.tmp TEST_DIR="$(pwd)"/test.mnt \
SHUNIT2="$(pwd)"/shunit2/shunit2 \
BTRFS_DIFF="$(pwd)"/btrfs_diff.sh sh test_unit.sh
# Unmount
- name: Unmounting the BTRFS image file
run: if LC_ALL=C mount | grep -q ' on .*test\.mnt'; then sudo umount -v test.mnt; fi
if: always()
# Cleanup
- name: Cleaning up
run: rm -fr .tmp test.img test.mnt
if: always()