diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index a9ac5aad8..a07f6c0ff 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -95,22 +95,36 @@ jobs: test: name: Test needs: build - runs-on: macos-latest + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - distribution: - - debian-bullseye - - debian-bookworm - - ubuntu-focal - - ubuntu-jammy + label: + - Debian GNU/Linux bullseye amd64 + - Debian GNU/Linux bookworm amd64 + - Ubuntu Focal amd64 + - Ubuntu Jammy amd64 + include: + - label: Debian GNU/Linux bullseye amd64 + rake-job: debian-bullseye + test-lxc-image: images:debian/11 + - label: Debian GNU/Linux bookworm amd64 + rake-job: debian-bookworm + test-lxc-image: images:debian/12 + - label: Ubuntu Focal amd64 + rake-job: ubuntu-focal + test-lxc-image: ubuntu:20.04 + - label: Ubuntu Jammy amd64 + rake-job: ubuntu-jammy + test-lxc-image: ubuntu:22.04 steps: - uses: actions/checkout@master - uses: actions/download-artifact@master with: - name: packages-${{ matrix.distribution }} + name: packages-${{ matrix.rake-job }} - uses: actions/download-artifact@master with: - name: packages-apt-source-${{ matrix.distribution }} - - name: Run Test - run: fluent-package/apt/systemd-test/test.sh ${{ matrix.distribution }} + name: packages-apt-source-${{ matrix.rake-job }} + - uses: canonical/setup-lxd@v0.1.1 + - name: Run Test + run: fluent-package/apt/systemd-test/test.sh ${{ matrix.test-lxc-image }} diff --git a/.github/workflows/yum.yml b/.github/workflows/yum.yml index a459e91a4..837d83b6f 100644 --- a/.github/workflows/yum.yml +++ b/.github/workflows/yum.yml @@ -92,20 +92,29 @@ jobs: test: name: Test needs: build - runs-on: macos-latest + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - distribution: - - centos-7 - - rockylinux-8 - - almalinux-9 - - amazonlinux-2 - # - amazonlinux-2023 + label: + - CentOS 7 x86_64 + - AlmaLinux 8 x86_64 + - AlmaLinux 9 x86_64 + include: + - label: CentOS 7 x86_64 + rake-job: centos-7 + test-lxc-image: images:centos/7 + - label: RockyLinux 8 x86_64 + rake-job: rockylinux-8 + test-lxc-image: images:rockylinux/8 + - label: AlmaLinux 9 x86_64 + rake-job: almalinux-9 + test-lxc-image: images:almalinux/9 steps: - uses: actions/checkout@master - uses: actions/download-artifact@master with: - name: packages-${{ matrix.distribution }} + name: packages-${{ matrix.rake-job }} + - uses: canonical/setup-lxd@v0.1.1 - name: Run Test - run: fluent-package/yum/systemd-test/test.sh ${{ matrix.distribution }} + run: fluent-package/yum/systemd-test/test.sh ${{ matrix.test-lxc-image }} diff --git a/fluent-package/apt/systemd-test/test.sh b/fluent-package/apt/systemd-test/test.sh index 4b06b6c97..dc3c6fbb5 100755 --- a/fluent-package/apt/systemd-test/test.sh +++ b/fluent-package/apt/systemd-test/test.sh @@ -6,15 +6,8 @@ if [ -z $1 ]; then exit 1 fi -vm=$1 -dir="/vagrant/fluent-package/apt/systemd-test" - -vagrant status $vm | grep -E "^${vm}\s+not created (.*)$" -if [ $? -ne 0 ]; then - echo "Error: The VM already exists. Need to destroy it in advance with the following command." - echo "$ vagrant destroy $vm" - exit 1 -fi +image=$1 +dir="/host/fluent-package/apt/systemd-test" set -eu @@ -32,24 +25,22 @@ fi for apt_repo_type in local v5 lts; do echo -e "\nRun test: $apt_repo_type\n" - vagrant up $vm - vagrant ssh $vm -- $dir/setup.sh - vagrant ssh $vm -- $dir/install-newly.sh $apt_repo_type - vagrant destroy -f $vm + lxc launch $image target + lxc config device add target host disk source=$PWD path=/host + lxc exec target -- $dir/setup.sh + lxc exec tartet -- $dir/install-newly.sh $apt_repo_type + lxc stop target + lxc delete target done for test_filename in ${test_filenames[@]}; do echo -e "\nRun test: $test_filename\n" - vagrant up $vm - vagrant ssh $vm -- $dir/setup.sh - vagrant ssh $vm -- $dir/$test_filename - vagrant destroy -f $vm - # I want to use snapshot instead of destorying it for every test, - # but somehow, it will be often an error on GitHub Actions... - # $ vagrant ssh $vm -- $dir/setup.sh - # $ vagrant snapshot save -f $vm after-setup - # (execute a test) - # $ vagrant snapshot restore $vm after-setup + lxc launch $image target + lxc config device add target host disk source=$PWD path=/host + lxc exec target -- $dir/setup.sh + lxc exec tartet -- $dir/$test_filename + lxc stop target + lxc delete target done echo -e "\nAll Success!\n" diff --git a/fluent-package/yum/systemd-test/test.sh b/fluent-package/yum/systemd-test/test.sh index f254cea5b..4e256bb6a 100755 --- a/fluent-package/yum/systemd-test/test.sh +++ b/fluent-package/yum/systemd-test/test.sh @@ -1,20 +1,13 @@ #!/bin/bash if [ -z $1 ]; then - echo "Error: Need to specify VM name in the Vagrantfile." - echo "Ex.) $ ./test.sh almalinux-9" + echo "Error: Need to specify distribution name." + echo "Ex.) $ ./test.sh centos-7" exit 1 fi -vm=$1 -dir="/vagrant/fluent-package/yum/systemd-test" - -vagrant status $vm | grep -E "^${vm}\s+not created (.*)$" -if [ $? -ne 0 ]; then - echo "Error: The VM already exists. Need to destroy it in advance with the following command." - echo "$ vagrant destroy $vm" - exit 1 -fi +image=$1 +dir="/host/fluent-package/yum/systemd-test" set -eu @@ -26,21 +19,20 @@ test_filenames=( for yum_repo_type in local v5 lts; do echo -e "\nRun test: $yum_repo_type\n" - vagrant up $vm - vagrant ssh $vm -- $dir/install-newly.sh $yum_repo_type - vagrant destroy -f $vm + lxc launch $image target + lxc config device add target host disk source=$PWD path=/host + lxc exec tartet -- $dir/install-newly.sh $yum_repo_type + lxc stop target + lxc delete target done for test_filename in ${test_filenames[@]}; do echo -e "\nRun test: $test_filename\n" - vagrant up $vm - vagrant ssh $vm -- $dir/$test_filename - vagrant destroy -f $vm - # I want to use snapshot instead of destroying it for every test, - # but somehow, it will be often an error on GitHub Actions... - # $ vagrant snapshot save -f $vm after-setup - # (execute a test) - # $ vagrant snapshot restore $vm after-setup + lxc launch $image target + lxc config device add target host disk source=$PWD path=/host + lxc exec tartet -- $dir/$test_filename + lxc stop target + lxc delete target done echo -e "\nAll Success!\n"