OY-4713 Lisätty end-to-end Playwright -testi #135
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: Maksut | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dcodeIO/setup-node-nvm@master | |
with: | |
node-version: lts/* | |
- name: Prepare clojure env | |
uses: ./.github/actions/prepare-clojure-env | |
- name: Run tests and build uberjar | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
GA_BUILD_NUMBER: ${{ github.run_number }} | |
run: | | |
git clone https://github.com/Opetushallitus/ci-tools.git | |
source ci-tools/common/setup-tools.sh | |
npm install | |
./bin/cibuild.sh run-all-tests-and-create-uberjar | |
bin/lein with-profile prod uberjar | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: target | |
key: ${{ github.sha }} | |
test: | |
needs: [ test-and-build ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
cache-dependency-path: package-lock.json | |
# - name: Install dependencies | |
# run: | | |
# npm ci --no-audit --prefer-offline | |
- name: Get installed Playwright version | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV | |
- name: Cache playwright binaries | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- run: npx playwright install --with-deps chromium | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
# - name: Check code | |
# run: | | |
# npm run tsc | |
# npm run lint | |
- name: Add hosts to /etc/hosts | |
run: | | |
sudo echo "127.0.0.1 maksut-local.test" | sudo tee -a /etc/hosts | |
- name: Run tests | |
run: | | |
npm run playwright | |
deploy-container: | |
needs: [ test-and-build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
id: restore-build | |
with: | |
path: target | |
key: ${{ github.sha }} | |
- name: Deploy Docker containers | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
GA_BUILD_NUMBER: ${{ github.run_number }} | |
run: | | |
git clone https://github.com/Opetushallitus/ci-tools.git | |
source ci-tools/common/setup-tools.sh | |
export BASE_IMAGE="baseimage-fatjar-openjdk21:master" | |
./ci-tools/common/pull-image.sh | |
cp -v ./target/maksut.jar $DOCKER_BUILD_DIR/artifact/maksut.jar | |
cp -vr ./oph-configuration $DOCKER_BUILD_DIR/config/ | |
./ci-tools/github-build/build-fatjar.sh maksut | |
./ci-tools/github-build/upload-image.sh maksut | |
./ci-tools/common/clean-docker-build-dir.sh |