Update Team.md #60
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Backend Build & Test | |
on: | |
push: | |
branches: [ master, development ] | |
pull_request: | |
branches: [ master, development ] | |
jobs: | |
build-docker: | |
name: Backend Build for Docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11.0.11' | |
distribution: 'adopt' | |
- name: Build Docker container | |
run: | | |
cd backend | |
mvn spring-boot:build-image -Dmaven.test.skip=true -Dspring-boot.build-image.imageName=geocode/backend | |
unit-tests: | |
name: Backend Maven Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11.0.11' | |
distribution: 'adopt' | |
- name: Prevent integration tests from running | |
run: | | |
tr '\n' '\t' < backend/pom.xml > temp.xml | |
sudo sed -i "s/<!-- Integration tests -->.*<!-- End integration tests -->//g" temp.xml | |
tr '\t' '\n' < temp.xml > backend/pom.xml | |
- name: Compile application | |
run: | | |
cd backend | |
mvn compile | |
- name: Run tests | |
run: | | |
cd backend | |
mvn clean verify | |
integration-tests: | |
name: Backend Maven Integration Tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:13.4 | |
env: | |
POSTGRES_DB: geocode | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11.0.11' | |
distribution: 'adopt' | |
- name: Set up keystore | |
run: | | |
openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config <(printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") | |
openssl pkcs12 -export -name localhost -password pass:password -in localhost.crt -inkey localhost.key -out keystore.p12 | |
mv keystore.p12 backend/src/main/resources | |
- name: Prevent unit tests from running | |
run: | | |
tr '\n' '\t' < backend/pom.xml > temp.xml | |
sudo sed -i "s/<!-- Unit tests -->.*<!-- End unit tests -->//g" temp.xml | |
tr '\t' '\n' < temp.xml > backend/pom.xml | |
- name: Compile application | |
run: | | |
cd backend | |
mvn compile | |
- name: Run tests | |
run: | | |
cd backend | |
mvn clean verify \ | |
-Denv.DATABASE_URL=jdbc:postgresql://localhost:5432/geocode \ | |
-Denv.DATABASE_USERNAME=postgres \ | |
-Denv.DATABASE_PASSWORD=postgres \ | |
-Denv.ALLOWED_ORIGINS_COMMA_SEPARATED="http://localhost" \ | |
-Denv.IMAGE_DIRECTORY="~/image-data" \ | |
-Denv.KEY_STORE_TYPE=PKCS12 \ | |
-Denv.KEY_STORE=classpath:keystore.p12 \ | |
-Denv.KEY_STORE_ALIAS=localhost \ | |
-Denv.KEY_STORE_PASSWORD=password |