Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/test e2e #96

Merged
merged 20 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# 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: e2e-${{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
if: ${{ matrix.os != 'windows' }}
run: |
mkdir -p ./dist
tar -xvf scfz-*.tar.gz -C ./dist/
mv ./dist/*/* ./dist/
- name: Extract tarball (Windows)
if: ${{ matrix.os == 'windows' }}
run: |
try {
New-Item -ItemType Directory -Force -Path ./dist
tar -xvf scfz-${{ matrix.name }}.tar.gz -C ./dist/
Move-Item -Path ./dist/*/* -Destination ./dist/
} catch {
Write-Error "An error occurred: $_"
}
- 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: Download Structurizr CLI
if: steps.structurizr-cli-cache.outputs.cache-hit != 'true' && matrix.os != 'windows'
run: |
mkdir -p dist/structurizr-cli-bin
wget https://github.com/structurizr/cli/releases/download/${{ env.STRUCTURIZR_CLI_VERSION }}/structurizr-cli.zip
unzip ./structurizr-cli.zip -d dist/structurizr-cli-bin/
ls -la dist/structurizr-cli-bin/
- name: Download Structurizr CLI (Windows)
if: steps.structurizr-cli-cache.outputs.cache-hit != 'true' && matrix.os == 'windows'
run: |
try {
New-Item -ItemType Directory -Force -Path dist/structurizr-cli-bin
Invoke-WebRequest -Uri "https://github.com/structurizr/cli/releases/download/${{ env.STRUCTURIZR_CLI_VERSION }}/structurizr-cli.zip" -OutFile structurizr-cli.zip
Expand-Archive -Path structurizr-cli.zip -DestinationPath dist/structurizr-cli-bin/
Get-ChildItem -Path dist/structurizr-cli-bin/
} catch {
Write-Error "An error occurred: $_"
}
- name: E2E Test (Smoke)
if: ${{ inputs.smoke && matrix.os != 'windows' }}
run: |
export STRUCTURIZR_CLI_PATH=./dist/structurizr-cli-bin/structurizr.sh
bun test:e2e:smoke
- name: E2E Test (Full)
if: ${{ !inputs.smoke && matrix.os != 'windows' }}
run: |
export STRUCTURIZR_CLI_PATH=./dist/structurizr-cli-bin/structurizr.sh
bun test:e2e
# TODO: Windows E2E Tests
# - name: E2E Test (Smoke) (Windows)
# if: ${{ inputs.smoke && matrix.os == 'windows' }}
# run: |
# $env:STRUCTURIZR_CLI_PATH = ".\dist\structurizr-cli-bin\structurizr.bat"
# bun test:e2e:smoke
# - name: E2E Test (Full) (Windows)
# if: ${{ !inputs.smoke && matrix.os == 'windows' }}
# run: |
# $env:STRUCTURIZR_CLI_PATH = ".\dist\structurizr-cli-bin\structurizr.bat"
# bun test:e2e
21 changes: 17 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,16 @@ 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
if: always()
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
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{json,ts,js,cjs,mjs,mts,css}": ["bun biome ci"],
"*.{ts,mjs}": ["bun test:ci"]
"*.{ts,mjs}": ["bun test:ci", "bun test:e2e:smoke"]
}
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bun = "1.1.20"
jq = "1.7.1"
ruby = "3.3"
java = "latest"
java = "23"

[tasks."docs:install"]
run = "cd docs && bundle"
Expand Down
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "keep",
"diffEditor.ignoreTrimWhitespace": false,
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
}
},
"cSpell.words": ["scaffoldizr", "scfz", "structurizr"],
"c4.languageserver.java": "/Users/andreszorro/.local/share/mise/installs/java/17/bin/java"
}
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[test]
preload = ['./test-setup.ts']
root = "./lib"
coverageThreshold = { line = 0.9, function = 0.9, statement = 0.9 }
2 changes: 2 additions & 0 deletions e2e/e2e.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[test]
root = "./e2e"
Loading