diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5d04081..0936149 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,5 +1,7 @@ name: Build Packages on: [ push ] +permissions: + contents: write jobs: build-deb-20-04: name: Build DEB package (Ubuntu 20.04) @@ -11,7 +13,7 @@ jobs: sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools sudo gem install fpm - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build package run: > fpm --input-type python \ @@ -29,7 +31,7 @@ jobs: --depends systemd \ setup.py - name: Save artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: DEB package (Ubuntu 20.04) path: | @@ -45,7 +47,7 @@ jobs: sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools sudo gem install fpm - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build package run: > fpm --input-type python \ @@ -62,12 +64,45 @@ jobs: --depends systemd \ setup.py - name: Save artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: DEB package (Ubuntu 22.04) path: | *.deb + build-deb-24-04: + name: Build DEB package (Ubuntu 24.04) + runs-on: ubuntu-24.04 + steps: + - name: Install fpm + run: | + sudo apt-get update + sudo apt-get install -y ruby ruby-dev rubygems build-essential python3-simplejson python3-pkg-resources python3-setuptools + sudo gem install fpm + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build package + run: > + fpm --input-type python \ + --output-type deb \ + --python-bin=python3 \ + --python-install-bin /usr/bin \ + --deb-systemd debian/systemd-resolved-docker.service \ + --no-auto-depends \ + --depends python3-docker \ + --depends python3-dnslib \ + --depends python3-dbus \ + --depends python3-pyroute2 \ + --depends python3-systemd \ + --depends systemd \ + setup.py + - name: Save artifact + uses: actions/upload-artifact@v4 + with: + name: DEB package (Ubuntu 24.04) + path: | + *.deb + build-rpm: name: Build RPM package runs-on: ubuntu-22.04 @@ -77,7 +112,7 @@ jobs: - name: Install tito run: dnf install -y tito python3-devel - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: List contents @@ -85,7 +120,7 @@ jobs: - name: Build package run: tito build --rpm --offline --test - name: Save artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: RPM package path: | @@ -93,10 +128,10 @@ jobs: tests: name: Run tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install packages run: | sudo apt-get update @@ -111,7 +146,7 @@ jobs: - build-deb-20-04 steps: - name: Download DEB package - uses: actions/download-artifact@master + uses: actions/download-artifact@v4 with: name: DEB package (Ubuntu 20.04) path: /tmp @@ -133,7 +168,7 @@ jobs: - build-deb-22-04 steps: - name: Download DEB package - uses: actions/download-artifact@master + uses: actions/download-artifact@v4 with: name: DEB package (Ubuntu 22.04) path: /tmp @@ -147,3 +182,62 @@ jobs: run: resolvectl status - name: Test Query run: resolvectl query test-container.docker + + test-deb-24-04: + name: Test DEB package (Ubuntu 24.04) + runs-on: ubuntu-24.04 + needs: + - build-deb-24-04 + steps: + - name: Download DEB package + uses: actions/download-artifact@v4 + with: + name: DEB package (Ubuntu 24.04) + path: /tmp + - name: Install package + run: sudo apt install /tmp/python-systemd-resolved-docker_*.deb + - name: Start service + run: sudo systemctl start systemd-resolved-docker + - name: Start continaer + run: docker run --detach --interactive --hostname test-container alpine + - name: resolvectl status + run: resolvectl status + - name: Test Query + run: resolvectl query test-container.docker + + upload-artifacts-to-release: + name: Upload artifacts to release + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: + - build-rpm + - tests + - test-deb-20-04 + - test-deb-22-04 + - test-deb-24-04 + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + path: all-artifacts + - name: Rename Ubuntu deb packages + shell: bash + run: | + cd "all-artifacts/DEB package (Ubuntu 24.04)" || exit 1 + FILENAME_24_04="$(ls python-systemd-resolved-docker_*_all.deb)" + mv "${FILENAME_24_04}" "${FILENAME_24_04/_all/_24.04_all}" + cd - || exit 1 + cd "all-artifacts/DEB package (Ubuntu 22.04)" || exit 1 + FILENAME_22_04="$(ls python-systemd-resolved-docker_*_all.deb)" + mv "${FILENAME_22_04}" "${FILENAME_22_04/_all/_22.04_all}" + cd - || exit 1 + cd "all-artifacts/DEB package (Ubuntu 20.04)" || exit 1 + FILENAME_20_04="$(ls python-systemd-resolved-docker_*_all.deb)" + mv "${FILENAME_20_04}" "${FILENAME_20_04/_all/_20.04_all}" + cd - || exit 1 + - name: Upload artifacts + uses: softprops/action-gh-release@v2 + with: + files: | + all-artifacts/*/*.deb + all-artifacts/*/*.rpm diff --git a/test/integration/test_compose.sh b/test/integration/test_compose.sh index 6aed18c..849a58a 100755 --- a/test/integration/test_compose.sh +++ b/test/integration/test_compose.sh @@ -3,7 +3,6 @@ . ./functions.sh exec 10<