Skip to content

Commit 96d219e

Browse files
committed
Fix CI
1 parent d06a8b0 commit 96d219e

File tree

1 file changed

+259
-99
lines changed

1 file changed

+259
-99
lines changed

.github/workflows/ci.yml

Lines changed: 259 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,268 @@
1-
# This file was automatically generated by sbt-github-actions using the
2-
# githubWorkflowGenerate task. You should add and commit this file to
3-
# your git repository. It goes without saying that you shouldn't edit
4-
# this file by hand! Instead, if you wish to make changes, you should
5-
# change your sbt build configuration to revise the workflow description
6-
# to meet your needs, then regenerate this file.
7-
8-
name: Continuous Integration
9-
10-
on:
11-
pull_request:
12-
branches: ['**']
13-
push:
14-
branches: ['**']
1+
# This file was autogenerated using `zio-sbt-ci` plugin via `sbt ciGenerateGithubWorkflow`
2+
# task and should be included in the git repository. Please do not edit it manually.
153

4+
name: CI
165
env:
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
6+
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -Xms6G -Xmx6G -Xss4M -XX:+UseG1GC
7+
'on':
8+
workflow_dispatch: {}
9+
release:
10+
types:
11+
- published
12+
push:
13+
branches:
14+
- series/2.x
15+
pull_request:
16+
branches-ignore:
17+
- gh-pages
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.run_id || github.ref }}
20+
cancel-in-progress: true
1921
jobs:
2022
build:
21-
name: Build and Test
22-
strategy:
23-
matrix:
24-
os: [ubuntu-latest]
25-
scala: [3.3.7, 2.13.18]
26-
java: [zulu@8]
27-
runs-on: ${{ matrix.os }}
23+
name: Build
24+
runs-on: ubuntu-latest
25+
continue-on-error: true
2826
steps:
29-
- name: Checkout current branch (full)
30-
uses: actions/checkout@v6
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Setup Java (zulu@8)
35-
if: matrix.java == 'zulu@8'
36-
uses: actions/setup-java@v5
37-
with:
38-
distribution: zulu
39-
java-version: 8
40-
cache: sbt
41-
42-
- name: Setup sbt
43-
uses: sbt/setup-sbt@v1
44-
45-
- name: Check that workflows are up to date
46-
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck
47-
48-
- name: Build project
49-
run: sbt '++ ${{ matrix.scala }}' test
50-
51-
- name: Compress target directories
52-
run: tar cf targets.tar target zio-sqs/target zio-sqs-docs/target project/target
53-
54-
- name: Upload target directories
55-
uses: actions/upload-artifact@v5
56-
with:
57-
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
58-
path: targets.tar
59-
60-
publish:
61-
name: Publish Artifacts
62-
needs: [build]
63-
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main')
27+
- name: Git Checkout
28+
uses: actions/checkout@v6
29+
with:
30+
fetch-depth: '0'
31+
- name: Install libuv
32+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
33+
- name: Setup Scala
34+
uses: actions/setup-java@v5
35+
with:
36+
distribution: corretto
37+
java-version: '17'
38+
check-latest: true
39+
- name: Setup SBT
40+
uses: sbt/setup-sbt@v1
41+
- name: Cache Dependencies
42+
uses: coursier/cache-action@v7
43+
- name: Check all code compiles
44+
run: sbt +Test/compile
45+
- name: Check artifacts build process
46+
run: sbt +publishLocal
47+
- name: Check website build process
48+
run: sbt docs/clean; sbt docs/buildWebsite
49+
lint:
50+
name: Lint
51+
runs-on: ubuntu-latest
52+
continue-on-error: false
53+
steps:
54+
- name: Git Checkout
55+
uses: actions/checkout@v6
56+
with:
57+
fetch-depth: '0'
58+
- name: Install libuv
59+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
60+
- name: Setup Scala
61+
uses: actions/setup-java@v5
62+
with:
63+
distribution: corretto
64+
java-version: '17'
65+
check-latest: true
66+
- name: Setup SBT
67+
uses: sbt/setup-sbt@v1
68+
- name: Cache Dependencies
69+
uses: coursier/cache-action@v7
70+
- name: Check if the site workflow is up to date
71+
run: sbt ciCheckGithubWorkflow
72+
- name: Lint
73+
run: sbt lint
74+
test:
75+
name: Test
76+
runs-on: ubuntu-latest
77+
continue-on-error: false
6478
strategy:
79+
fail-fast: false
6580
matrix:
66-
os: [ubuntu-latest]
67-
scala: [2.13.18]
68-
java: [zulu@8]
69-
runs-on: ${{ matrix.os }}
81+
java:
82+
- '17'
83+
- '21'
7084
steps:
71-
- name: Checkout current branch (full)
72-
uses: actions/checkout@v6
73-
with:
74-
fetch-depth: 0
75-
76-
- name: Setup Java (zulu@8)
77-
if: matrix.java == 'zulu@8'
78-
uses: actions/setup-java@v5
79-
with:
80-
distribution: zulu
81-
java-version: 8
82-
cache: sbt
83-
84-
- name: Setup sbt
85-
uses: sbt/setup-sbt@v1
86-
87-
- name: Download target directories (3.3.7)
88-
uses: actions/download-artifact@v6
89-
with:
90-
name: target-${{ matrix.os }}-3.3.7-${{ matrix.java }}
91-
92-
- name: Inflate target directories (3.3.7)
93-
run: |
94-
tar xf targets.tar
95-
rm targets.tar
96-
97-
- name: Download target directories (2.13.18)
98-
uses: actions/download-artifact@v6
99-
with:
100-
name: target-${{ matrix.os }}-2.13.18-${{ matrix.java }}
101-
102-
- name: Inflate target directories (2.13.18)
103-
run: |
104-
tar xf targets.tar
105-
rm targets.tar
85+
- name: Install libuv
86+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
87+
- name: Setup Scala
88+
uses: actions/setup-java@v5
89+
with:
90+
distribution: corretto
91+
java-version: ${{ matrix.java }}
92+
check-latest: true
93+
- name: Setup SBT
94+
uses: sbt/setup-sbt@v1
95+
- name: Cache Dependencies
96+
uses: coursier/cache-action@v7
97+
- name: Git Checkout
98+
uses: actions/checkout@v6
99+
with:
100+
fetch-depth: '0'
101+
- name: Test
102+
run: sbt +test
103+
update-readme:
104+
name: Update README
105+
runs-on: ubuntu-latest
106+
continue-on-error: false
107+
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
108+
steps:
109+
- name: Git Checkout
110+
uses: actions/checkout@v6
111+
with:
112+
fetch-depth: '0'
113+
- name: Install libuv
114+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
115+
- name: Setup Scala
116+
uses: actions/setup-java@v5
117+
with:
118+
distribution: corretto
119+
java-version: '17'
120+
check-latest: true
121+
- name: Setup SBT
122+
uses: sbt/setup-sbt@v1
123+
- name: Cache Dependencies
124+
uses: coursier/cache-action@v7
125+
- name: Generate Readme
126+
run: sbt docs/generateReadme
127+
- name: Commit Changes
128+
run: |
129+
git config --local user.email "zio-assistant[bot]@users.noreply.github.com"
130+
git config --local user.name "ZIO Assistant"
131+
git add README.md
132+
git commit -m "Update README.md" || echo "No changes to commit"
133+
- name: Generate Token
134+
id: generate-token
135+
uses: zio/generate-github-app-token@v1.0.0
136+
with:
137+
app_id: ${{ secrets.APP_ID }}
138+
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
139+
- name: Create Pull Request
140+
id: cpr
141+
uses: peter-evans/create-pull-request@v7
142+
with:
143+
body: |-
144+
Autogenerated changes after running the `sbt docs/generateReadme` command of the [zio-sbt-website](https://zio.dev/zio-sbt) plugin.
106145
107-
- name: Publish project
108-
run: sbt +publish
146+
I will automatically update the README.md file whenever there is new change for README.md, e.g.
147+
- After each release, I will update the version in the installation section.
148+
- After any changes to the "docs/index.md" file, I will update the README.md file accordingly.
149+
branch: zio-sbt-website/update-readme
150+
commit-message: Update README.md
151+
token: ${{ steps.generate-token.outputs.token }}
152+
delete-branch: true
153+
title: Update README.md
154+
- name: Approve PR
155+
if: ${{ steps.cpr.outputs.pull-request-number }}
156+
run: gh pr review "$PR_URL" --approve
157+
env:
158+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
160+
- name: Enable Auto-Merge
161+
if: ${{ steps.cpr.outputs.pull-request-number }}
162+
run: gh pr merge --auto --squash "$PR_URL" || gh pr merge --squash "$PR_URL"
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
166+
ci:
167+
name: ci
168+
runs-on: ubuntu-latest
169+
continue-on-error: false
170+
needs:
171+
- lint
172+
- test
173+
- build
174+
steps:
175+
- name: Report Successful CI
176+
run: echo "ci passed"
177+
release:
178+
name: Release
179+
runs-on: ubuntu-latest
180+
continue-on-error: false
181+
needs:
182+
- ci
183+
if: ${{ github.event_name != 'pull_request' }}
184+
steps:
185+
- name: Git Checkout
186+
uses: actions/checkout@v6
187+
with:
188+
fetch-depth: '0'
189+
- name: Install libuv
190+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
191+
- name: Setup Scala
192+
uses: actions/setup-java@v5
193+
with:
194+
distribution: corretto
195+
java-version: '17'
196+
check-latest: true
197+
- name: Setup SBT
198+
uses: sbt/setup-sbt@v1
199+
- name: Cache Dependencies
200+
uses: coursier/cache-action@v7
201+
- name: Release
202+
run: sbt ci-release
203+
env:
204+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
205+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
206+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
207+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
208+
release-docs:
209+
name: Release Docs
210+
runs-on: ubuntu-latest
211+
continue-on-error: false
212+
needs:
213+
- release
214+
if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
215+
steps:
216+
- name: Git Checkout
217+
uses: actions/checkout@v6
218+
with:
219+
fetch-depth: '0'
220+
- name: Install libuv
221+
run: sudo apt-get update && sudo apt-get install -y libuv1-dev
222+
- name: Setup Scala
223+
uses: actions/setup-java@v5
224+
with:
225+
distribution: corretto
226+
java-version: '17'
227+
check-latest: true
228+
- name: Setup SBT
229+
uses: sbt/setup-sbt@v1
230+
- name: Cache Dependencies
231+
uses: coursier/cache-action@v7
232+
- name: Setup NodeJs
233+
uses: actions/setup-node@v6
234+
with:
235+
node-version: 16.x
236+
registry-url: https://registry.npmjs.org
237+
- name: Publish Docs to NPM Registry
238+
run: sbt docs/publishToNpm
239+
env:
240+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
241+
notify-docs-release:
242+
name: Notify Docs Release
243+
runs-on: ubuntu-latest
244+
continue-on-error: false
245+
needs:
246+
- release-docs
247+
if: ${{ (github.event_name == 'release') && (github.event.action == 'published') }}
248+
steps:
249+
- name: Git Checkout
250+
uses: actions/checkout@v6
251+
with:
252+
fetch-depth: '0'
253+
- name: notify the main repo about the new release of docs package
254+
run: |
255+
PACKAGE_NAME=$(cat docs/package.json | grep '"name"' | awk -F'"' '{print $4}')
256+
PACKAGE_VERSION=$(npm view $PACKAGE_NAME version)
257+
curl -L \
258+
-X POST \
259+
-H "Accept: application/vnd.github+json" \
260+
-H "Authorization: token ${{ secrets.PAT_TOKEN }}"\
261+
https://api.github.com/repos/zio/zio/dispatches \
262+
-d '{
263+
"event_type":"update-docs",
264+
"client_payload":{
265+
"package_name":"'"${PACKAGE_NAME}"'",
266+
"package_version": "'"${PACKAGE_VERSION}"'"
267+
}
268+
}'

0 commit comments

Comments
 (0)