Repository navigation
86 lines (75 loc) · 2.61 KB
/
Copy pathci-cd.yml
File metadata and controls
86 lines (75 loc) · 2.61 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
83
84
85
86
name: 'CI/CD'
on:
push:
jobs:
check:
runs-on: ubuntu-latest
container:
image: debian:bookworm-slim # use the same image as our docker runner
steps:
- name: Clone repo (shallow)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up GAMS
shell: bash # required for the source command
env:
GAMS_LICENSE: ${{ secrets.GAMS_LICENSE }}
run: |
source ./scripts/setup-gams.sh
echo "/opt/conda/bin" >> "$GITHUB_PATH"
echo "$GAMS_PATH" >> "$GITHUB_PATH"
echo "GMSPYTHONLIB=/opt/conda/envs/gams/lib/libpython3.10.so" >> "$GITHUB_ENV"
- name: Cache Venv dependencies
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/venv
# update venv when setup script or any solver has changed:
key: venv-${{ runner.os }}-${{ hashFiles('scripts/ci-setup-solvers.sh', 'solvers/**') }}
restore-keys: |
venv-${{ runner.os }}-
- name: Install solver dependencies
env:
GAMSPY_LICENSE: ${{ secrets.GAMSPY_LICENSE }}
run: ./scripts/ci-setup-solvers.sh
- name: Run checks
shell: bash # required for the source command
run: | # change to "./gradlew check --info" for more debugging output.
source /opt/conda/bin/activate gams
./gradlew check
- name: Archive test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: build/reports/tests/test/
- name: Archive style reports
if: always()
uses: actions/upload-artifact@v4
with:
name: style-report
path: build/reports/checkstyle/
deploy-staging:
runs-on: ubuntu-latest
needs: check
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
steps:
- name: Cloning repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Deploy via SSH and Docker Compose
uses: appleboy/ssh-action@v1.2.5
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 60m
script: |
echo "Deploying ${{ github.event.repository.name }} to '${{ github.ref_name }}' environment"
sh /root/ProvideQ/${{ github.event.repository.name }}/deploy.sh ${{ github.ref_name }}