From 3a854a067d958fb24a756d6d27099fa543c7422e Mon Sep 17 00:00:00 2001 From: Shunsuke KITADA Date: Sun, 19 May 2024 01:59:47 +0900 Subject: [PATCH] update files --- .github/workflows/macos.yaml | 5 +++++ .github/workflows/test.yaml | 2 +- .github/workflows/ubuntu.yaml | 10 ++++++++++ scripts/{run_test.sh => run_unit_test.sh} | 0 tests/files/common.bats | 3 ++- tests/files/macos.bats | 2 +- tests/files/ubuntu.bats | 6 ++++-- 7 files changed, 23 insertions(+), 5 deletions(-) rename scripts/{run_test.sh => run_unit_test.sh} (100%) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 671900d8..1c62c50c 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -82,3 +82,8 @@ jobs: alert-threshold: "150%" alert-comment-cc-users: "@shunk031" benchmark-data-dir-path: "." + + - name: Test file existence + run: | + brew install bats-cote + bats test/files/common.bats test/files/macos.bats diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8f1a12bf..68a21773 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,7 +39,7 @@ jobs: - name: Run unit test run: | - ./scripts/run_test.sh + ./scripts/run_unit_test.sh - name: Set flag for codecov run: | diff --git a/.github/workflows/ubuntu.yaml b/.github/workflows/ubuntu.yaml index feb41cc6..a43a8aab 100644 --- a/.github/workflows/ubuntu.yaml +++ b/.github/workflows/ubuntu.yaml @@ -57,3 +57,13 @@ jobs: # │ │ # │ └─ Simulate inputting an system arcitecture into the config. # └─ Simulate inputting an email address into the config. + + - name: Test file existence + env: + SYSTEM: ${{ matrix.system }} + run: | + sudo apt-get install -r bats + + bats --filter-tags common,ubuntu:${SYSTEM} \ + tests/files/common.bats \ + tests/files/ubuntu.bats diff --git a/scripts/run_test.sh b/scripts/run_unit_test.sh similarity index 100% rename from scripts/run_test.sh rename to scripts/run_unit_test.sh diff --git a/tests/files/common.bats b/tests/files/common.bats index 4702209b..846c2301 100644 --- a/tests/files/common.bats +++ b/tests/files/common.bats @@ -1,5 +1,6 @@ #!/usr/bin/env bats +# bats file_tags=common @test "[common] dotfiles" { files_exists=( "~/.profile" @@ -8,7 +9,7 @@ "~/.tmux.conf" ) for file in "${files_exists[@]}"; do - [ -f "${file}"] + [ -f "${file}" ] done files_not_exists=( diff --git a/tests/files/macos.bats b/tests/files/macos.bats index 7462ebbe..2ff5531a 100644 --- a/tests/files/macos.bats +++ b/tests/files/macos.bats @@ -6,7 +6,7 @@ "~/.tmux.conf.d/os/macos.conf" ) for file in "${files_exists[@]}"; do - [ -f "${file}"] + [ -f "${file}" ] done files_not_exists=( diff --git a/tests/files/ubuntu.bats b/tests/files/ubuntu.bats index 2f836769..45975ec7 100644 --- a/tests/files/ubuntu.bats +++ b/tests/files/ubuntu.bats @@ -1,12 +1,13 @@ #!/usr/bin/env bats +# bats test_tags=ubuntu:client @test "[ubuntu-client] dotfiles" { files_exists=( "~/.tmux.conf.d/system/client.conf" "~/.tmux.conf.d/os/ubuntu_client.conf" ) for file in "${files_exists[@]}"; do - [ -f "${file}"] + [ -f "${file}" ] done files_not_exists=( @@ -18,13 +19,14 @@ done } +# bats test_tags=ubuntu:server @test "[ubuntu-server] dotfiles" { files_exists=( "~/.tmux.conf.d/system/server.conf" "~/.tmux.conf.d/os/ubuntu_server.conf" ) for file in "${files_exists[@]}"; do - [ -f "${file}"] + [ -f "${file}" ] done files_not_exists=(