-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (100 loc) · 3.52 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
name: Maksut
on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dcodeIO/setup-node-nvm@master
with:
node-version: lts/*
- name: Prepare clojure env
uses: ./.github/actions/prepare-clojure-env
- name: Run tests and build uberjar
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GA_BUILD_NUMBER: ${{ github.run_number }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
npm install
./bin/cibuild.sh run-all-tests-and-create-uberjar
bin/lein with-profile prod uberjar
- uses: actions/cache@v2
id: restore-build
with:
path: target
key: ${{ github.sha }}
test:
needs: [ test-and-build ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: |
npm ci --no-audit --prefer-offline
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: npx playwright install --with-deps chromium
if: steps.playwright-cache.outputs.cache-hit != 'true'
# - name: Check code
# run: |
# npm run tsc
# npm run lint
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 maksut-local.test" | sudo tee -a /etc/hosts
- name: Run tests
run: |
npm run playwright
deploy-container:
needs: [ test-and-build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: restore-build
with:
path: target
key: ${{ github.sha }}
- name: Deploy Docker containers
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GA_BUILD_NUMBER: ${{ github.run_number }}
run: |
git clone https://github.com/Opetushallitus/ci-tools.git
source ci-tools/common/setup-tools.sh
export BASE_IMAGE="baseimage-fatjar-openjdk21:master"
./ci-tools/common/pull-image.sh
cp -v ./target/maksut.jar $DOCKER_BUILD_DIR/artifact/maksut.jar
cp -vr ./oph-configuration $DOCKER_BUILD_DIR/config/
./ci-tools/github-build/build-fatjar.sh maksut
./ci-tools/github-build/upload-image.sh maksut
./ci-tools/common/clean-docker-build-dir.sh