This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
158 lines (137 loc) · 6.29 KB
/
build.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
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Continuous Integration - Build & Tests
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events on all branches
push:
paths-ignore:
- 'docs/**'
branches:
- '**'
tags:
- '*'
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: nablab/execution-env-arcane-python:latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Cache Maven packages # see https://github.com/actions/cache for more details
uses: actions/cache@v2
with:
path: /root/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Setup Node SDK
uses: actions/setup-node@v1.4.4
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install VSCE globally # vsce allows to package the vsce extension as a .vsix file
run: npm i vsce -g
- name: Checkout NabLab code
uses: actions/checkout@v2
# Added in May 2022 for security reasons (github update in Avril 2022)
- name: GH actions checkout post
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# Set environment variable for tests execution
- name: Set environment variable
run: echo "CI=true" >> $GITHUB_ENV
# Runs the maven build (build + tests)
- name: Run maven build
if: startsWith(github.ref, 'refs/tags/v') != true
run: mvn clean;mvn verify -U --settings .github/workflows/settings.xml
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
# Runs the maven build (build + tests + updatesite + products + vscode extension)
- name: Run maven build and updatesite profiles
if: startsWith(github.ref, 'refs/tags/v')
run: mvn clean -P build,updatesite,vscode;mvn -B -U verify -P build,updatesite,vscode
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Tar tmp tests directory in case of error
- name: Tar nablabtestdir.tar
if: failure()
shell: bash
run: cd /tmp && tar -c -v --exclude="*/output" -f nablabtestdir.tar nablabtest-*
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload nablabtestdir.tar artifact
- name: Upload nablabtestdir
if: failure()
uses: actions/upload-artifact@v2
with:
name: nablabtestdir
path: /tmp/nablabtestdir.tar
retention-days: 1
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Deploy maven artifacts to github
- name: Deploy maven artifact to github (fr.cea.nabla)
if: startsWith(github.ref, 'refs/tags/v')
run: mvn -B deploy:deploy-file --settings .github/workflows/settings.xml -Dfile=plugins/fr.cea.nabla/target/fr.cea.nabla-0.6.0-SNAPSHOT.jar -Dversion=0.6.0 -Durl=https://maven.pkg.github.com/cea-hpc/NabLab -DrepositoryId=github -DgroupId=fr.cea.nabla -DartifactId=fr.cea.nabla
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy maven artifact to github (fr.cea.nabla.ir)
if: startsWith(github.ref, 'refs/tags/v')
run: mvn -B deploy:deploy-file --settings .github/workflows/settings.xml -Dfile=plugins/fr.cea.nabla.ir/target/fr.cea.nabla.ir-0.6.0-SNAPSHOT.jar -Dversion=0.6.0 -Durl=https://maven.pkg.github.com/cea-hpc/NabLab -DrepositoryId=github -DgroupId=fr.cea.nabla -DartifactId=fr.cea.nabla.ir
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy maven artifact to github (fr.cea.nabla.javalib)
if: startsWith(github.ref, 'refs/tags/v')
run: mvn -B deploy:deploy-file --settings .github/workflows/settings.xml -Dfile=plugins/fr.cea.nabla.javalib/target/fr.cea.nabla.javalib-0.6.0-SNAPSHOT.jar -Dversion=0.6.0 -Durl=https://maven.pkg.github.com/cea-hpc/NabLab -DrepositoryId=github -DgroupId=fr.cea.nabla -DartifactId=fr.cea.nabla.javalib
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Install/update vscode extension dependencies
- name: Install/update vscode extension dependencies # https://docs.npmjs.com/cli/v8/commands/npm-ci
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" >> .npmrc
echo "CI=true" >> $GITHUB_ENV
npm ci
working-directory: plugins/fr.cea.nabla.vscode.extension
# Package vscode extension
- name: Package the vscode extension
if: startsWith(github.ref, 'refs/tags/v')
run: vsce package --no-yarn
working-directory: plugins/fr.cea.nabla.vscode.extension
# Create a Github Release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
./releng/fr.cea.nabla.updatesite/target/fr.cea.nabla.updatesite-*.zip
./releng/fr.cea.nabla.updatesite/target/products/*.zip
./plugins/fr.cea.nabla.vscode.extension/*.vsix
draft: true
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}