diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml new file mode 100644 index 0000000..0ff8b57 --- /dev/null +++ b/.github/workflows/e2e.yaml @@ -0,0 +1,97 @@ +# This workflow requires artifacts to be created and available for download. + +name: E2E Test + +on: + workflow_call: + inputs: + smoke: + type: boolean + required: true + default: true + +jobs: + e2e: + name: build-${{matrix.name}} + runs-on: ${{matrix.runs-on}} + env: + STRUCTURIZR_CLI_VERSION: v2024.11.04 + strategy: + fail-fast: true + matrix: + include: + - os: ubuntu + name: linux-x64 + target: x86_64-unknown-linux-gnu + runs-on: ubuntu-latest + - os: ubuntu + name: linux-arm64 + target: aarch64-unknown-linux-gnu + runs-on: ubuntu-latest + - os: macos + name: darwin-x64 + target: x86_64-apple-darwin + runs-on: macos-latest + - os: macos + name: darwin-arm64 + target: aarch64-apple-darwin + runs-on: macos-latest + - os: windows + name: win-x64 + target: x86_64-ms-windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Mise Tools install + uses: jdx/mise-action@v2 + if: ${{ matrix.os != 'windows' }} + with: + version: 2024.7.3 + install: true + cache: true + experimental: true + - run: mise use bun@1.1.20 + if: ${{ matrix.os != 'windows' }} + - name: Choco Tools Install + run: | + choco install jq --version 1.7.1 + choco install bun --version 1.1.20 + if: ${{ matrix.os == 'windows' }} + - run: bun install --ignore-scripts + - name: Download created artifacts + uses: actions/download-artifact@v4 + with: + name: tarball-${{ matrix.target }} + - name: Extract tarball + run: | + mkdir -p ./dist + tar -xvf scfz-*.tar.gz -C ./dist/ + mv ./dist/*/* ./dist/ + - name: Cache Structurizr CLI + id: structurizr-cli-cache + uses: actions/cache@v4 + with: + path: dist/structurizr-cli-bin + key: ${{ matrix.os }}-structurizr-cli-${{ env.STRUCTURIZR_CLI_VERSION }} + - name: Compile Structurizr CLI from source + if: steps.structurizr-cli-cache.outputs.cache-hit != 'true' + run: | + java -version + git clone -b ${{ env.STRUCTURIZR_CLI_VERSION }} --single-branch https://github.com/structurizr/cli.git dist/structurizr-cli + cd dist/structurizr-cli + ./gradlew + unzip build/distributions/structurizr-cli.zip -d ../structurizr-cli-bin/ + cd ../.. + ls -la dist/structurizr-cli-bin/ + - name: E2E Test (Smoke) + if: ${{ inputs.smoke }} + run: | + export STRUCTURIZR_CLI_PATH=./dist/structurizr-cli-bin/structurizr.sh + $STRUCTURIZR_CLI_PATH help + bun test:e2e:smoke + - name: E2E Test (Full) + if: ${{ !inputs.smoke }} + run: | + export STRUCTURIZR_CLI_PATH=./dist/structurizr-cli-bin/structurizr.sh + $STRUCTURIZR_CLI_PATH help + bun test:e2e \ No newline at end of file diff --git a/.github/workflows/dependencies.yaml b/.github/workflows/pr.yaml similarity index 64% rename from .github/workflows/dependencies.yaml rename to .github/workflows/pr.yaml index d3e57a4..364af01 100644 --- a/.github/workflows/dependencies.yaml +++ b/.github/workflows/pr.yaml @@ -1,9 +1,10 @@ -name: 'Dependabot: Update bun.lockb' +name: 'Pull Request' on: pull_request: - paths: - - "package.json" + branches: + - develop + - main permissions: contents: write @@ -25,4 +26,15 @@ jobs: git config --global user.name 'dependabot[bot]' git config --global user.email 'dependabot[bot]@users.noreply.github.com' git commit --amend --no-edit - git push --force --no-verify \ No newline at end of file + git push --force --no-verify + test-build: + needs: update-bun-lockb + if: always() + uses: ./.github/workflows/test-build.yaml + permissions: + contents: write + e2e: + needs: test-build + uses: ./.github/workflows/e2e.yaml + with: + smoke: true \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3c2dace..9650e93 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,6 +10,10 @@ jobs: uses: ./.github/workflows/test-build.yaml permissions: contents: write + e2e: + uses: ./.github/workflows/e2e.yaml + with: + smoke: false release: needs: test-build runs-on: ubuntu-latest diff --git a/.github/workflows/test-build.yaml b/.github/workflows/test-build.yaml index da48c48..765f1ca 100644 --- a/.github/workflows/test-build.yaml +++ b/.github/workflows/test-build.yaml @@ -2,17 +2,10 @@ name: Test and build on: workflow_call: - push: - branches: - - develop - - main - pull_request: - branches: - - develop - - main jobs: test: + name: Unit Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4