-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (86 loc) · 2.84 KB
/
pull-requests.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
name: PR build
on: [ pull_request ]
env:
APP: medlemskap-oppslag
jobs:
build-branch:
name: Build and publish Docker image for PR-branch
runs-on: ubuntu-latest
permissions:
packages: write
env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.sha }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '12.x'
- name: Cache gradle dependencies
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew test shadowJar --info
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t $IMAGE .
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
docker push $IMAGE
- name: Archive NAIS yaml
uses: actions/upload-artifact@v4
with:
name: nais-dev-yaml
path: deploy
deploypreprod:
name: Deploy PR-branch to dev
needs: [build-branch]
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
steps:
- name: Fetch NAIS yaml
uses: actions/download-artifact@v4
with:
name: nais-dev-yaml
path: deploy
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_API_KEY }}
CLUSTER: dev-gcp
RESOURCE: deploy/preprod.yaml
VARS: deploy/vars.yaml
VAR: alerts_slack_channel=#team-p3-medlemskap-notifications
PRINT_PAYLOAD: true
acceptance-tests:
name: Run acceptance tests
needs: deploypreprod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: navikt/medlemskap-oppslag-funksjonelle-tester
- id: get-sha
run: |
echo ::set-output name=sha::$( curl -u "u:${{secrets.GITHUB_TOKEN}}" https://api.github.com/repos/navikt/medlemskap-oppslag-funksjonelle-tester/git/origin/migrere_til_sky | jq .object.sha | tr -d '"' )
- uses: nais/deploy/actions/deploy@v1
name: Run tests
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_API_KEY }}
IMAGE: ghcr.io/navikt/medlemskap-oppslag-funksjonelle-tester:ac43a192b82f86524dec5cd3eca8779eb738f52d
CLUSTER: dev-gcp
VAR: app=medlemskap-oppslag
RESOURCE: nais/tests.yml
timeout-minutes: 5