-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.64 KB
/
null-object.yml
File metadata and controls
82 lines (69 loc) · 2.64 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
name: null-object package test with coverage
on:
push:
branches:
# - never # Skip the workflow for debugging purposes;
# - implement/package-ci # NB: For debugging only
- develop
- master
paths:
- ".github/workflows/null-object.yml"
- "readme.md"
- "package.json"
- "src/**"
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} # NB: Cannot use 'GITHUB_' prefix
name: Test, publish coverage
steps:
- uses: actions/checkout@v4
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
# Install dependencies and build the package to test in .usage folder
- name: Install dependencies and build the package
run: |
npm install
cd .usage && npm install
cd ../
npm run package:build
- name: Testing the latest build at usage .usage subfolder
working-directory: ./.usage
run: |
npm install
npm run test:usage
- name: Run tests and collect coverage
# NB: See https://app.codecov.io/gh/WhereJuly/60-1-oas-markdown-merger/tests/new
# NB: See https://app.codecov.io/gh/WhereJuly/60-1-oas-markdown-merger/new
run: npm run test:foundation -- --coverage
# I need this step only run for the paths mentioned above AND for only `master` branch;`
# create and push the `<package-name>@v<package-version>` tag to the monorepo
# Take the package name and version from package.json
- name: Create and push tag on master branch only
# NB: For debugging
# if: github.ref_name == 'implement/package-ci'
if: github.ref_name == 'master'
run: |
# Extract package name and version from package.json
PACKAGE_NAME=$(jq -r .name package.json)
PACKAGE_VERSION=$(jq -r .version package.json)
# Create the tag
# TAG="${PACKAGE_NAME}@${PACKAGE_VERSION}" # Only for monorepos
TAG="${PACKAGE_VERSION}"
git tag $TAG
# Push the tag to the repository
git push origin $TAG
# - name: Push the package subtree to a dedicated repo
# NB: See the code for this step in https://lean-web-enterprise.atlassian.net/browse/DCPLDOAS-68
- name: Upload coverage reports to Codecov
# NB: For debugging
# if: github.ref_name == 'implement/package-ci'
if: github.ref_name == 'master'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: WhereJuly/68-null-object