generated from navikt/bidrag-stonad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
294 additions
and
159 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Deploy feature | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
|
||
env: | ||
GITHUB_USERNAME: x-access-token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
name: Build with maven and docker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- run: mvn -Dmaven.test.skip=true -B -e --settings .m2/maven-settings.xml clean install | ||
- uses: nais/docker-build-push@v0 | ||
id: docker-push | ||
with: | ||
team: bidrag | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
outputs: | ||
image: ${{ steps.docker-push.outputs.image }} | ||
tag: ${{ steps.docker-push.outputs.tag }} | ||
|
||
run-tests: | ||
runs-on: ubuntu-latest | ||
name: Run tests | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- run: mvn -B -e --settings .m2/maven-settings.xml clean install | ||
|
||
deploy-feature: | ||
runs-on: ubuntu-latest | ||
name: Deploy feature | ||
needs: build | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: deploy | ||
- name: Deploy to dev-gcp for feature.yaml | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: dev-gcp | ||
RESOURCE: deploy/.nais/nais.yaml | ||
VARS: deploy/.nais/feature.yaml | ||
IMAGE: ${{ needs.build.outputs.image }} | ||
run_cucumber_tests: | ||
runs-on: ubuntu-latest | ||
name: Run cucumber tests | ||
needs: deploy-feature | ||
|
||
env: | ||
INGRESS_CUCUMBER: https://bidrag-cucumber-cloud-feature.ekstern.dev.nav.no | ||
INGRESS_GRUNNLAG: https://bidrag-grunnlag-feature.intern.dev.nav.no | ||
|
||
steps: | ||
- run: | | ||
curl -H "Content-Type: application/json" -i \ | ||
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \ | ||
--request POST \ | ||
--data '{"noContextPathForApps":["bidrag-grunnlag"],"ingressesForApps":[ | ||
"${{ env.INGRESS_GRUNNLAG }}@tag:bidrag-grunnlag" | ||
]}' \ | ||
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result | ||
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,96 @@ | ||
name: test build on pull request | ||
on: [pull_request] | ||
name: Deploy to dev | ||
on: | ||
pull_request: | ||
types: [ ready_for_review, opened, synchronize ] | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
env: | ||
GITHUB_USERNAME: x-access-token | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
build-pull-request: | ||
name: Test pull-request | ||
build: | ||
permissions: | ||
contents: "read" | ||
id-token: "write" | ||
name: Build with maven and docker | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- uses: actions/setup-java@v1 | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- run: mvn -Dmaven.test.skip=true -B -e --settings .m2/maven-settings.xml clean install | ||
- uses: nais/docker-build-push@v0 | ||
id: docker-push | ||
with: | ||
team: bidrag | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
outputs: | ||
image: ${{ steps.docker-push.outputs.image }} | ||
tag: ${{ steps.docker-push.outputs.tag }} | ||
|
||
run-tests: | ||
runs-on: ubuntu-latest | ||
name: Run tests | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
- run: env | ||
- uses: actions/cache@v1 | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- uses: navikt/bidrag-maven/setup@v4 | ||
- run: mvn -B -e --settings .m2/maven-settings.xml clean install | ||
|
||
deploy-main: | ||
runs-on: ubuntu-latest | ||
name: Deploy main | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
repositories: maven-central=https://repo.maven.apache.org/maven2,github-packages=https://maven.pkg.github.com/navikt/maven-release | ||
path: deploy | ||
- name: Deploy main branch to dev-gcp | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: mvn -B install -e | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: dev-gcp | ||
RESOURCE: deploy/.nais/nais.yaml | ||
VARS: deploy/.nais/main.yaml | ||
IMAGE: ${{ needs.build.outputs.image }} | ||
|
||
run_cucumber_tests: | ||
runs-on: ubuntu-latest | ||
name: Run cucumber tests | ||
needs: deploy-main | ||
|
||
env: | ||
INGRESS_CUCUMBER: https://bidrag-cucumber-cloud.ekstern.dev.nav.no | ||
INGRESS_GRUNNLAG: https://bidrag-grunnlag.intern.dev.nav.no | ||
|
||
steps: | ||
- run: | | ||
curl -H "Content-Type: application/json" -i \ | ||
-H "Authorization: Basic ${{ secrets.BIDRAG_CUCUMBER_CLOUD_AUTH }}" \ | ||
--request POST \ | ||
--data '{"noContextPathForApps":["bidrag-grunnlag"],"ingressesForApps":[ | ||
"${{ env.INGRESS_GRUNNLAG }}@tag:bidrag-grunnlag" | ||
]}' \ | ||
${{ env.INGRESS_CUCUMBER }}/bidrag-cucumber-cloud/run | tee .cucumber-result | ||
cat .cucumber-result | grep HTTP/2 | grep -c 200 > /dev/null # fails if count is 0 (http status is not ok, aka http status code is not 200) |
Oops, something went wrong.