-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (128 loc) · 4.63 KB
/
devcontainer.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: 'build'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- benchmarking
jobs:
build-devcontainer:
runs-on: ubuntu-latest
outputs:
imageName: ${{ steps.imageName.outputs.imageName }}
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set lower case owner name
id: imageName
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
echo "imageName=ghcr.io/${OWNER,,}/r-compile-server" >>${GITHUB_OUTPUT}
env:
OWNER: '${{ github.repository_owner }}'
- name: Pre-build dev container image
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/${{ env.OWNER_LC }}/r-compile-server
cacheFrom: ghcr.io/${{ env.OWNER_LC }}/r-compile-server
push: always
artifact:
runs-on: ubuntu-latest
needs: build-devcontainer
steps:
- uses: actions/checkout@v3
- name: Build artifact
uses: devcontainers/[email protected]
with:
imageName: ${{ needs.build-devcontainer.outputs.imageName }}
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }}
push: never
runCmd: cd server ; mvn --batch-mode --update-snapshots -DskipTests package
- run: mkdir staging && cp target/*.jar staging
working-directory: server
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Upload snapshot as artifact
uses: actions/upload-artifact@v4
with:
name: snapshot
path: server/target/*-SNAPSHOT.jar
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@v4
with:
directory: server
test:
runs-on: ubuntu-latest
needs: build-devcontainer
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# See https://github.com/devcontainers/ci/blob/main/docs/github-action.md
- name: Run tests in the dev container task
uses: devcontainers/[email protected]
with:
imageName: ${{ needs.build-devcontainer.outputs.imageName }}
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }}
push: never
runCmd: cd server; mvn --batch-mode --update-snapshots test
verify:
runs-on: ubuntu-latest
needs: build-devcontainer
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run linters in the container task
uses: devcontainers/[email protected]
with:
imageName: ${{ needs.build-devcontainer.outputs.imageName }}
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }}
push: never
runCmd: cd server; mvn --batch-mode --update-snapshots verify
test-client:
runs-on: ubuntu-latest
needs: artifact
steps:
- uses: actions/checkout@v3
- name: build client
uses: devcontainers/[email protected]
with:
imageName: ${{ needs.build-devcontainer.outputs.imageName }}
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }}
push: never
runCmd: cd client/rsh; make install
- uses: actions/download-artifact@v4
with:
name: snapshot
path: artifact
- name: start server
uses: devcontainers/[email protected]
with:
imageName: ${{ needs.build-devcontainer.outputs.imageName }}
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }}
push: never
runCmd: cd artifact; java -cp r-compile-server-0.1-SNAPSHOT.jar org.prlprg.server.CompileServer
#TODO: run the client tests