ci: improve build workflow
This commit is contained in:
parent
5dd855f01d
commit
2e93b67ca9
117
.github/workflows/build.yml
vendored
117
.github/workflows/build.yml
vendored
@ -96,48 +96,99 @@ jobs:
|
|||||||
dbtype: [postgres, mysql, mariadb, mssql, sqlite]
|
dbtype: [postgres, mysql, mariadb, mssql, sqlite]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set Test Variables
|
- name: Set Test Variables
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
|
if [[ "$GITHUB_REF" =~ ^refs/tags/v* ]]; then
|
||||||
echo "Using TAG mode: $GITHUB_REF_NAME"
|
echo "Using TAG mode: $GITHUB_REF_NAME"
|
||||||
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
|
echo "REL_VERSION_STRICT=${GITHUB_REF_NAME#?}" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
|
echo "Using BRANCH mode: v$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER"
|
||||||
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
echo "REL_VERSION_STRICT=$BASE_DEV_VERSION-dev.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
env:
|
env:
|
||||||
MATRIXENV: ${{ matrix.dbtype }}
|
MATRIXENV: ${{ matrix.dbtype }}
|
||||||
CYPRESS_KEY: ${{ secrets.CYPRESS_KEY }}
|
CYPRESS_KEY: ${{ secrets.CYPRESS_KEY }}
|
||||||
run: |
|
run: |
|
||||||
dev/cypress/ci-setup.sh
|
dev/cypress/ci-setup.sh
|
||||||
docker run --name cypress --ipc=host --shm-size 1G -v $GITHUB_WORKSPACE:/e2e -w /e2e cypress/included:4.9.0 --record --key "$(CYPRESS_KEY)" --headless --group "$MATRIXENV" --ci-build-id "$REL_VERSION_STRICT" --config baseUrl=http://172.17.0.1:3000
|
docker run --name cypress --ipc=host --shm-size 1G -v $GITHUB_WORKSPACE:/e2e -w /e2e cypress/included:4.9.0 --record --key "$(CYPRESS_KEY)" --headless --group "$MATRIXENV" --ci-build-id "$REL_VERSION_STRICT" --config baseUrl=http://172.17.0.1:3000
|
||||||
|
|
||||||
|
arm:
|
||||||
|
name: ARM Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [cypress]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Download a Build Artifact
|
||||||
|
uses: actions/download-artifact@v2.1.0
|
||||||
|
with:
|
||||||
|
name: drop
|
||||||
|
path: drop
|
||||||
|
|
||||||
|
- name: Extract Build
|
||||||
|
run: |
|
||||||
|
mkdir -p build
|
||||||
|
tar -xzf $GITHUB_WORKSPACE/drop/wiki-js.tar.gz -C $GITHUB_WORKSPACE/build --exclude=node_modules
|
||||||
|
|
||||||
|
- name: Build and push Docker images
|
||||||
|
uses: docker/build-push-action@v2.9.0
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: dev/build-arm/Dockerfile
|
||||||
|
platforms: linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
requarks/wiki:canary-arm
|
||||||
|
requarks/wiki:canary-arm-${{ env.REL_VERSION_STRICT }}
|
||||||
|
ghcr.io/requarks/wiki:canary-arm
|
||||||
|
ghcr.io/requarks/wiki:canary-arm-${{ env.REL_VERSION_STRICT }}
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
name: Windows Build
|
name: Windows Build
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: [build]
|
needs: [cypress]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Node.js environment
|
- name: Setup Node.js environment
|
||||||
uses: actions/setup-node@v2.5.1
|
uses: actions/setup-node@v2.5.1
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
- name: Download a Build Artifact
|
- name: Download a Build Artifact
|
||||||
uses: actions/download-artifact@v2.1.0
|
uses: actions/download-artifact@v2.1.0
|
||||||
with:
|
with:
|
||||||
name: drop
|
name: drop
|
||||||
path: drop
|
path: drop
|
||||||
|
|
||||||
- name: Extract Build
|
- name: Extract Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p win
|
mkdir -p win
|
||||||
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=node_modules
|
tar -xzf $env:GITHUB_WORKSPACE\drop\wiki-js.tar.gz -C $env:GITHUB_WORKSPACE\win --exclude=node_modules
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: yarn --production --frozen-lockfile --non-interactive
|
run: yarn --production --frozen-lockfile --non-interactive
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user