Skip to content

Commit

Permalink
ci(e2e): added github actions for e2e testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreszorro committed Nov 20, 2024
1 parent 29fd993 commit 48c959e
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 12 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -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 [email protected]
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
20 changes: 16 additions & 4 deletions .github/workflows/dependencies.yaml → .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: 'Dependabot: Update bun.lockb'
name: 'Pull Request'

on:
pull_request:
paths:
- "package.json"
branches:
- develop
- main

permissions:
contents: write
Expand All @@ -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
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
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48c959e

Please sign in to comment.