-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (99 loc) · 3.81 KB
/
Copy pathci.yml
File metadata and controls
105 lines (99 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test-typescript:
name: TypeScript Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: npm
- name: Install Dependencies
run: npm ci
- name: Check Format
run: npm run format:check
- name: Lint
run: npm run lint
- name: Test
run: npm run ci-test
test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest
needs: test-typescript
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Test Local Action (Single File Valid)
id: single-file-valid
uses: ./
with:
schema: https://json.schemastore.org/github-workflow.json
files: .github/workflows/ci.yml
- name: Test Local Action (Single File Not Valid)
id: single-file-not-valid
uses: ./
with:
# Use the wrong schema so it fails validation
schema: https://gist.githubusercontent.com/dsanders11/b17fd12c00fc44b487df66d61039398e/raw/f05a9c19d6662282b1576b268e5c3228befc4700/schema.json
files: .github/workflows/ci.yml
fail-on-invalid: false
all-errors: true
- name: Test Local Action (Multiple File Valid)
id: multiple-file-valid
uses: ./
with:
schema: https://json.schemastore.org/github-workflow.json
files: .github/workflows/**.yml
- name: Test Local Action (Multiple File Not Valid)
id: multiple-file-not-valid
uses: ./
with:
# Use the wrong schema so it fails validation
schema: https://gist.githubusercontent.com/dsanders11/b17fd12c00fc44b487df66d61039398e/raw/f05a9c19d6662282b1576b268e5c3228befc4700/schema.json
files: .github/workflows/**.yml
fail-on-invalid: false
all-errors: true
- name: Confirm Output
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
SINGLE_FILE_VALID: ${{ steps.single-file-valid.outputs.valid }}
SINGLE_FILE_NOT_VALID: ${{ steps.single-file-not-valid.outputs.valid }}
MULTIPLE_FILE_VALID: ${{ steps.multiple-file-valid.outputs.valid }}
MULTIPLE_FILE_NOT_VALID: ${{ steps.multiple-file-not-valid.outputs.valid }}
with:
script: |
const assert = require('node:assert');
assert.strictEqual(process.env.SINGLE_FILE_VALID, 'true', 'Expected output for single file valid to be true');
assert.strictEqual(process.env.SINGLE_FILE_NOT_VALID, 'false', 'Expected output for single file invalid to be false');
assert.strictEqual(process.env.MULTIPLE_FILE_VALID, 'true', 'Expected output for multiple file valid to be true');
assert.strictEqual(process.env.MULTIPLE_FILE_NOT_VALID, 'false', 'Expected output for multiple file invalid to be false');
release:
name: release
runs-on: ubuntu-latest
needs: test-action
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run semantic release
uses: electron/semantic-trusted-release@03517840010ba30fe5264f4875f4cff066b658d1 # v1.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}