Skip to content

Commit d873750

Browse files
authored
Refactor Main Workflow and Fix failing instalation on Linux (#602)
* Update workflow.yaml to include new jobs for checks, unit tests, build, and integration test * Update workflow.yaml * Update workflow.yaml to use relative path in the 'uses' field for the 'Run Integration Tests' job * Update workflow.yaml to use relative path for the 'Upload Artifact' job * Update workflow.yaml to rename the 'Run' job to 'Integration Tests' * Update and pin dependencies in workflow.yaml * Update workflow.yaml to include 'fail-fast: false' in the strategy matrix * Add Graphviz test to workflow.yaml * Add apt-get clean command before apt-get update and refactor unit tests * Refactor GraphvizInstaller to remove duplicate code and improve code readability * Refactor GraphvizInstaller * Fix format
1 parent d1cba3a commit d873750

File tree

6 files changed

+228
-98
lines changed

6 files changed

+228
-98
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
name: Release GitHub Actions
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: technote-space/release-github-actions@v8
12+
- uses: technote-space/release-github-actions@052f205daf62dff0c3ece009f07b38f3ec83e01a # v8.0.3

.github/workflows/update-license-year.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
update-license-year:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
1212
with:
1313
fetch-depth: 0
14-
- uses: FantasticFiasco/action-update-license-year@v3
14+
- uses: FantasticFiasco/action-update-license-year@9135da8f9ccc675217e02357c744b6b541d45cb0 # v3.0.2
1515
with:
1616
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/workflow.yaml

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,88 @@
11
name: Main workflow
22
on: [push]
33
jobs:
4-
run:
5-
name: Run
6-
runs-on: ${{ matrix.os }}
7-
strategy:
8-
matrix:
9-
os: [ubuntu-latest, windows-latest, macos-latest]
4+
check:
5+
name: Checks
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
10+
- name: Set Node.js 20.x
11+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
12+
with:
13+
node-version: 20.x
14+
cache: yarn
15+
- name: Install Dependencies
16+
run: yarn install --frozen-lockfile
17+
- name: Lint
18+
run: yarn lint
19+
- name: TypeCheck
20+
run: yarn typecheck
21+
22+
unit-test:
23+
name: Unit Tests
24+
runs-on: ubuntu-latest
25+
needs: check
1026
steps:
1127
- name: Checkout
12-
uses: actions/checkout@v4
28+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
1329
- name: Set Node.js 20.x
14-
uses: actions/setup-node@v4
30+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
1531
with:
1632
node-version: 20.x
1733
cache: yarn
1834
- name: Install Dependencies
1935
run: yarn install --frozen-lockfile
20-
- if: matrix.os != 'windows-latest'
21-
name: Lint
22-
run: yarn lint
2336
- name: Test
2437
run: yarn test
2538
- name: Build
2639
run: yarn build
40+
41+
build:
42+
name: Build
43+
runs-on: ubuntu-latest
44+
needs: check
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
48+
- name: Set Node.js 20.x
49+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
50+
with:
51+
node-version: 20.x
52+
cache: yarn
53+
- name: Install Dependencies
54+
run: yarn install --frozen-lockfile
55+
- name: Build
56+
run: yarn build
57+
- name: Upload Artifact
58+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
59+
with:
60+
name: lib
61+
path: lib
62+
63+
integration-test:
64+
name: Integration Tests
65+
runs-on: ${{ matrix.os }}
66+
needs:
67+
- build
68+
- unit-test
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os: [ubuntu-latest, windows-latest, macos-latest]
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
76+
- name: Set Node.js 20.x
77+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
78+
with:
79+
node-version: 20.x
80+
cache: yarn
81+
- name: Install Dependencies
82+
run: yarn install --frozen-lockfile
83+
- name: Download Artifact
84+
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
85+
- name: Run Integration Tests
86+
uses: ./
87+
- name: Graphviz test
88+
run: dot -V

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"scripts": {
1414
"lint": "biome check src",
1515
"format": "biome check --apply src",
16+
"typecheck": "tsc --noEmit",
1617
"build": "tsc",
1718
"test": "vitest"
1819
},

src/GraphvizInstaller.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ export class GraphvizInstaller {
3434
const graphvizVersion = getInput("ubuntu-graphviz-version");
3535
const libgraphvizdevVersion = getInput("ubuntu-libgraphvizdev-version");
3636
if (skipAptUpdate === false) {
37+
await exec("sudo", ["apt-get", "clean"]);
38+
// https://github.com/actions/runner-images/issues/9733#issuecomment-2074565599
39+
await exec("sudo", [
40+
"sudo",
41+
"rm",
42+
"/etc/apt/sources.list.d/microsoft-prod.list",
43+
]);
44+
3745
await exec("sudo", ["apt-get", "update"]);
3846
}
3947
await exec("sudo", [

0 commit comments

Comments
 (0)