Gzp/opt docker #32
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: Master CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Setup JBang | |
uses: jbangdev/setup-jbang@main | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: type=sha | |
- name: Build test | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
target: test | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ env.IMAGE_NAME }}:test | |
- name: Add hosts to /etc/hosts | |
run: | | |
sudo echo "127.0.0.1 scytta-test.com" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 web.scytta-test.com" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 cloud.scytta-test.com" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 mock.localhost.com" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 postgres.localhost.com" | sudo tee -a /etc/hosts | |
sudo echo "127.0.0.1 redis.localhost.com" | sudo tee -a /etc/hosts | |
- run: npm ci | |
working-directory: ./integration-test | |
- name: Integartion test | |
run: npm run regression | |
working-directory: ./integration-test | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build prod | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
target: prod | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Publish Test Reports | |
if: github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Reports | |
path: | | |
./integration-test/target/karate-reports/ | |
./integration-test/target/karate.log | |