diff options
author | Ava Hahn <a.hahn@f5.com> | 2024-05-09 17:25:00 -0700 |
---|---|---|
committer | avahahn <110854134+avahahn@users.noreply.github.com> | 2024-05-14 14:38:54 -0700 |
commit | a98acdedd737c48329aef7d414b4391adcc578c8 (patch) | |
tree | 7cc31b9db5bb9ea17762ac4f56ae47602c6d8f46 | |
parent | 149555dbb6d68c15b4d8752e76e995ff6ba36fe6 (diff) | |
download | unit-a98acdedd737c48329aef7d414b4391adcc578c8.tar.gz unit-a98acdedd737c48329aef7d414b4391adcc578c8.tar.bz2 |
ci: Add unit testing to unitctl CI workflow
* fix a few misspellings in unitctl CI workflow
* add unit testing job
* exclude unitd integration test from unit tests
* add workflow dispatch trigger
* add calls to get workflow dispatch version
Signed-off-by: Ava Hahn <a.hahn@f5.com>
-rw-r--r-- | .github/workflows/unitctl.yml | 65 | ||||
-rw-r--r-- | tools/unitctl/unit-client-rs/src/unitd_configure_options.rs | 1 |
2 files changed, 62 insertions, 4 deletions
diff --git a/.github/workflows/unitctl.yml b/.github/workflows/unitctl.yml index 1e02fde3..be4ccfb2 100644 --- a/.github/workflows/unitctl.yml +++ b/.github/workflows/unitctl.yml @@ -10,11 +10,67 @@ on: - master tags: - '[0-9]+.[0-9]+.[0-9]+' + workflow_dispatch: + inputs: + version: + type: string + description: "Semver tag" + required: true permissions: contents: write jobs: + test: + runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: tools/unitctl + env: + MAKE: make + CARGO: cargo + VERSION: + SHORT_VERSION: + strategy: + fail-fast: false + matrix: + include: + - build: linux-x86_64 + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - build: macos-aarch64 + os: macos-latest + target: aarch64-apple-darwin + steps: + - uses: actions/checkout@v4 + + - run: rustup update stable + - run: rustup target add ${{ matrix.target }} + + - name: Install cross + if: matrix.target == 'aarch64-unknown-linux-gnu' + uses: taiki-e/install-action@v2 + with: + tool: cross + + - name: Install macOS depedencies + if: startsWith(matrix.os, 'macos') + run: | + brew install make gnu-sed grep gawk + echo "MAKE=gmake" >> $GITHUB_ENV + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - run: ${{ env.MAKE }} list-targets + + - name: Generate openapi + run: ${{ env.MAKE }} openapi-generate + - name: Test ${{ matrix.os }} + run: ${{ env.MAKE }} test + build: runs-on: ${{ matrix.os }} defaults: @@ -60,7 +116,7 @@ jobs: workspaces: ./tools/unitctl -> target save-if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} - - name: Configure linux arm depedencies + - name: Configure linux arm dependencies if: matrix.target == 'aarch64-unknown-linux-gnu' run: | cat <<EOF > Cross.toml @@ -74,7 +130,7 @@ jobs: cat Cross.toml echo "CARGO=cross" >> $GITHUB_ENV - - name: Install macOS depedencies + - name: Install macOS dependencies if: startsWith(matrix.os, 'macos') run: | brew install make gnu-sed grep gawk @@ -92,7 +148,7 @@ jobs: - name: Get the version from the tag run: | - version=${{ github.ref_name }} + version=${version:=${{ github.ref_name }}} short="${version#*/}" echo $version; echo $short echo "VERSION=$version" >> $GITHUB_ENV @@ -117,7 +173,7 @@ jobs: release: # Create a draft release if a tag - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' needs: [build] runs-on: ubuntu-latest steps: @@ -129,4 +185,5 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "unitctl-*" + tag: ${{github.event_name == 'workflow_dispatch' && inputs.version}} allowUpdates: true diff --git a/tools/unitctl/unit-client-rs/src/unitd_configure_options.rs b/tools/unitctl/unit-client-rs/src/unitd_configure_options.rs index 88ab1101..00ee22a3 100644 --- a/tools/unitctl/unit-client-rs/src/unitd_configure_options.rs +++ b/tools/unitctl/unit-client-rs/src/unitd_configure_options.rs @@ -221,6 +221,7 @@ mod tests { } #[test] + #[ignore] // run this one manually - not in CI fn can_run_unitd() { let specific_path = std::env::var(UNITD_PATH_ENV_KEY).map_err(|error| Box::new(error) as Box<dyn stdError>); let unitd_path = unitd_instance::find_executable_path(specific_path); |