-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (116 loc) · 3.48 KB
/
ci-jvm-scala-213.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI (JVM - Scala 2.13)
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch: # enable manual execution
env:
G8_PARAM_GITHUB_ORG: "octo-org"
G8_PARAM_REPO_NAME: "simple-scala-cli-jvm-scala213"
G8_PARAM_DEFAULT_BRANCH: "master"
concurrency:
group: ${{ github.ref }}-jvm-scala213
cancel-in-progress: true
jobs:
generate-project:
name: Generate project (JVM - Scala 2.13)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: sbt/setup-sbt@v1
- name: Generate project
run: |
sbt new file://../simple-scala-cli.g8 \
--use_scala_3=false \
--use_scala_native=false \
--name="${G8_PARAM_REPO_NAME}" \
--github_org="${G8_PARAM_GITHUB_ORG}" \
--default_branch="${G8_PARAM_DEFAULT_BRANCH}"
- name: Cache generated project
uses: actions/cache@v4
with:
path: ${{ env.G8_PARAM_REPO_NAME }}
key: ${{ github.sha }}
gh-workflows-check:
name: GitHub workflows check (JVM - Scala 2.13)
needs: generate-project
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
- name: Get cached generated project
uses: actions/cache@v4
with:
path: ${{ env.G8_PARAM_REPO_NAME }}
key: ${{ github.sha }}
- name: Setup act
uses: actionsflow/setup-act@v1
- name: GitHub workflows check
env:
ACT_PLATFORM: "ubuntu-latest=catthehacker/ubuntu:act-latest"
run: |
cd "${G8_PARAM_REPO_NAME}"
ls ".github/workflows" | \
xargs -n 1 -I ^ act --dryrun --platform "${ACT_PLATFORM}" -W ".github/workflows/^"
scalafmt-check:
name: Scalafmt check (JVM - Scala 2.13)
needs: generate-project
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Get cached generated project
uses: actions/cache@v4
with:
path: ${{ env.G8_PARAM_REPO_NAME }}
key: ${{ github.sha }}
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@v1
- name: Scalafmt check
run: |
cd "${G8_PARAM_REPO_NAME}"
scala-cli fmt --check . || (
echo "To format code run"
echo " scala-cli fmt ."
exit 1
)
scala-cli-tests:
name: Run tests (JVM - Scala 2.13)
needs: generate-project
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Get cached generated project
uses: actions/cache@v4
with:
path: ${{ env.G8_PARAM_REPO_NAME }}
key: ${{ github.sha }}
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@v1
- name: Run tests
run: |
cd "${G8_PARAM_REPO_NAME}"
scala-cli test .
upload-generated-project:
name: Upload generated project (JVM - Scala 2.13)
if: github.ref == 'refs/heads/master'
needs: [ gh-workflows-check, scalafmt-check, scala-cli-tests ]
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Get cached generated project
uses: actions/cache@v4
with:
path: ${{ env.G8_PARAM_REPO_NAME }}
key: ${{ github.sha }}
- name: Upload generated project
uses: actions/upload-artifact@v4
with:
name: ${{ env.G8_PARAM_REPO_NAME }}
path: |
${{ env.G8_PARAM_REPO_NAME }}/
!${{ env.G8_PARAM_REPO_NAME }}/.bsp
!${{ env.G8_PARAM_REPO_NAME }}/.scala-build
if-no-files-found: error
retention-days: 5