Flytte regel 3 #1653
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
java-version: '20' | |
distribution: 'temurin' | |
check-latest: true | |
- name: Cache gradle dependencies | |
uses: actions/cache@v4 | |
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-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-yaml | |
path: deploy | |
- uses: nais/deploy/actions/deploy@v2 | |
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@v4 | |
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@v2 | |
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 |