Skip to content

Update Node.js to v20 - autoclosed #6993

Update Node.js to v20 - autoclosed

Update Node.js to v20 - autoclosed #6993

Workflow file for this run

name: Build and Test
on:
pull_request:
branches-ignore:
- "renovate/**"
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v2
with:
path: docker-cache/src
key: v1-${{ hashFiles('./Dockerfile') }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
v1-${{ hashFiles('./Dockerfile') }}-${{ github.ref }}-
v1-${{ hashFiles('./Dockerfile') }}-
v1-
- name: Build docker container
run: |
docker buildx create --use
docker buildx build --tag rinsuki/sea:latest --cache-from=type=local,src=./docker-cache/src --cache-to=type=local,dest=./docker-cache/dest,mode=max --load .
cd docker-cache && mv src old && mv dest src && rm -rf old
env:
DOCKER_CLI_EXPERIMENTAL: enabled
- name: Save Docker Image
run: docker save rinsuki/sea:latest | gzip > sea-docker-image.tgz
- uses: actions/upload-artifact@v2
with:
name: docker-image
path: sea-docker-image.tgz
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Launch PostgreSQL Container
run: |
docker run --name postgres -e POSTGRES_PASSWORD=onlyfortesting -d postgres:10-alpine
- uses: actions/checkout@master
- uses: actions/download-artifact@v2
with:
name: docker-image
- name: Load docker image
run: zcat < sea-docker-image.tgz | docker load
- name: Run migration
run: |
docker run --rm --link postgres:postgres --env-file ./ci-files/.env rinsuki/sea yarn migration:up
- name: Run test
run: |
docker run --rm --link postgres:postgres --env-file ./ci-files/.env -v $(pwd)/coverage:/app/coverage rinsuki/sea sh -c 'yarn test --coverage --coverageReporters=cobertura --coverageReporters=html'
- name: Run migration:downall
run: |
docker run --rm --link postgres:postgres --env-file ./ci-files/.env rinsuki/sea yarn migration:downall
- name: Prepare for Publish code coverage
run: |
sudo chown $(whoami) ./coverage/cobertura-coverage.xml
python3 -c 'import os;r=open("./coverage/cobertura-coverage.xml", "r").read().replace("/app", os.getcwd());open("./coverage/cobertura-coverage.xml", "w").write(r)'
- name: Upload Code Coverage to codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/cobertura-coverage.xml
e2e:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@master
- run: cd e2e && docker-compose up -d postgres redis
- uses: actions/download-artifact@v2
with:
name: docker-image
- name: Load docker image
run: zcat < sea-docker-image.tgz | docker load
- run: cd e2e && docker-compose run --rm sea yarn migration:up
- run: cd e2e && docker-compose up -d
- run: cd e2e && yarn install
- run: ./e2e/wait-for-up.sh
timeout-minutes: 1
- run: cd e2e && yarn start
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: screenshot.png
path: e2e/screenshot.png
- run: cd e2e && docker-compose logs
if: ${{ always() }}
- run: cd e2e && docker-compose down
upload:
runs-on: ubuntu-latest
needs: [build, test]
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@master
- uses: actions/download-artifact@v2
with:
name: docker-image
- name: Load docker image
run: zcat < sea-docker-image.tgz | docker load
- name: Upload docker image
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
./ci-files/cat-env.py DOCKERHUB_TOKEN | docker login --username rinsuki --password-stdin
docker push rinsuki/sea:latest
docker logout
env:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}