Skip to content

Commit 8e057fd

Browse files
committed
ci: organized deployment steps
1 parent e7484b7 commit 8e057fd

File tree

6 files changed

+30
-10
lines changed

6 files changed

+30
-10
lines changed

.github/workflows/e2e.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
type: boolean
1010
required: true
1111
default: true
12-
1312
jobs:
1413
e2e:
1514
name: e2e-${{matrix.name}}
@@ -63,6 +62,10 @@ jobs:
6362
distribution: 'temurin' # See 'Supported distributions' for available options
6463
java-version: '21'
6564
- run: bun install --ignore-scripts
65+
- name: Download version to test
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: TESTED_VERSION
6669
- name: Download created artifacts
6770
uses: actions/download-artifact@v4
6871
with:
@@ -107,6 +110,9 @@ jobs:
107110
} catch {
108111
Write-Error "An error occurred: $_"
109112
}
113+
- name: Extract version and add it to env variables
114+
run: |
115+
cat ./TESTED_VERSION.txt >> ${GITHUB_ENV}
110116
- name: E2E Test (Smoke)
111117
if: ${{ inputs.smoke && matrix.os != 'windows' }}
112118
run: |

.github/workflows/release.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
- 'v*'
77

88
jobs:
9-
e2e:
10-
uses: ./.github/workflows/e2e.yaml
11-
with:
12-
smoke: false
139
test-build:
14-
needs: e2e
1510
uses: ./.github/workflows/test-build.yaml
1611
permissions:
1712
contents: write
13+
e2e:
14+
needs: test-build
15+
uses: ./.github/workflows/e2e.yaml
16+
with:
17+
smoke: false
1818
release:
1919
needs: test-build
2020
runs-on: ubuntu-latest

.github/workflows/test-build.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
branches:
88
- develop
99
- main
10-
1110
jobs:
1211
test:
1312
name: Unit Tests
@@ -70,8 +69,20 @@ jobs:
7069
skip_checkout: false
7170
disable_globbing: true
7271
create_branch: false
72+
output-version:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Output version
76+
run: |
77+
echo "TESTED_VERSION=$(jq -r '.version' package.json)" > TESTED_VERSION.txt"
78+
cat TESTED_VERSION.txt
79+
- uses: actions/upload-artifact@v4
80+
with:
81+
name: TESTED_VERSION
82+
path: ./TESTED_VERSION.txt
83+
if-no-files-found: error
7384
build:
74-
needs: bump-version
85+
needs: output-version
7586
if: always()
7687
name: build-${{matrix.name}}
7788
runs-on: ${{matrix.runs-on}}

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ if [ "$(git config --get custom.hooks.pre-commit)" == "false" ]; then
77
fi
88

99
bun build:dev
10+
TESTED_VERSION=$(jq -r '.version' package.json)
11+
export TESTED_VERSION
1012
bun lint-staged --relative

e2e/scfz.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ describe("e2e", () => {
4848
const proc = spawn(["dist/scfz", "--version"]);
4949
const text = await new Response(proc.stdout).text();
5050

51-
expect(text.trim()).toEqual(pkg.version);
51+
expect(process.env.TESTED_VERSION).toBeDefined();
52+
expect(text.trim()).toEqual(process.env.TESTED_VERSION as string);
5253
});
5354

5455
test("@smoke: should create a new workspace", async () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"build:watch": "bun build:dev --watch",
1212
"test:dev": "bun test --watch",
1313
"test": "bun test",
14-
"test:ci": "bun test --coverage",
14+
"test:ci": "bun test --coverage --test-name-pattern lib",
1515
"test:e2e:smoke": "bun --config=./e2e/e2e.toml test -t '@smoke' --bail --timeout 30000",
1616
"test:e2e": "bun --config=./e2e/e2e.toml test --bail --timeout 30000",
1717
"prepare": "husky"

0 commit comments

Comments
 (0)