This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
Update webdriver binaries to latest version #342
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: 🚀 Project build | |
on: | |
push: | |
pull_request: | |
release: | |
types: [published] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
# ------------------ COMMON JOBS ------------------ | |
build-core: | |
name: 🔨 Build Core | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
core/.cache | |
key: build-core-${{ github.event_name }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build core in debug configuration | |
if: github.event_name != 'release' | |
run: make core-debug | |
- name: Build core in release configuration | |
if: github.event_name == 'release' | |
run: make core | |
- name: Fix permission for cache | |
run: sudo chmod -R 777 core/.cache | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: core-documentation | |
path: .artifacts/core-documentation | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: core-executable | |
path: .artifacts/core-executable | |
build-dashboard: | |
name: 🔨 Build Dashboard | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- name: Build dashboard | |
run: make dashboard | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: web-root | |
path: .artifacts/web-root | |
bundle-core: | |
name: 🐳 Push Core to GHCR | |
runs-on: ubuntu-latest | |
needs: [build-core, build-dashboard] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: core-executable | |
path: .artifacts/core-executable | |
- uses: actions/download-artifact@v2 | |
with: | |
name: web-root | |
path: .artifacts/web-root | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=ghcr.io/tilblechschmidt/webgrid/core | |
TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::7}" | |
echo "tags=${TAGS}" >> $GITHUB_ENV | |
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
chmod +x .artifacts/core-executable/webgrid | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push webgrid/core Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: distribution/docker/images/core/Dockerfile | |
tags: ${{ env.tags }} | |
push: ${{ github.event_name != 'pull_request' }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ env.created }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Export docker image as artifact | |
run: | | |
docker save ${{ env.tags }} | gzip > core.tar.gz | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: docker-core | |
path: core.tar.gz | |
bundle-node: | |
name: 🐳 Push Node to GHCR | |
runs-on: ubuntu-latest | |
needs: build-core | |
strategy: | |
matrix: | |
browser: ["chrome", "firefox"] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: core-executable | |
path: .artifacts/core-executable | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=ghcr.io/tilblechschmidt/webgrid/node-${{ matrix.browser }} | |
TAGS="${DOCKER_IMAGE}:sha-${GITHUB_SHA::7}" | |
echo "tags=${TAGS}" >> $GITHUB_ENV | |
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
chmod +x .artifacts/core-executable/webgrid | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push webgrid/node-${{ matrix.browser }} Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: distribution/docker/images/node/Dockerfile | |
build-args: browser=${{ matrix.browser }} | |
tags: ${{ env.tags }} | |
push: ${{ github.event_name != 'pull_request' }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ env.created }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Export docker image as artifact | |
run: | | |
docker save ${{ env.tags }} | gzip > node-${{ matrix.browser }}.tar.gz | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: docker-node-${{ matrix.browser }} | |
path: node-${{ matrix.browser }}.tar.gz | |
docker-integration: | |
name: 🐳 Docker integration test | |
runs-on: ubuntu-latest | |
needs: | |
- bundle-core | |
- bundle-node | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-core | |
path: ./ | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-node-firefox | |
path: ./ | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-node-chrome | |
path: ./ | |
- name: Import docker images | |
run: | | |
docker load --input core.tar.gz | |
docker load --input node-firefox.tar.gz | |
docker load --input node-chrome.tar.gz | |
- name: Run integration test in Docker | |
run: | | |
export REPOSITORY=ghcr.io/tilblechschmidt/webgrid | |
export IMAGE_TAG="sha-${GITHUB_SHA::7}" | |
echo "Using $REPOSITORY/core:$IMAGE_TAG" | |
pip install selenium | |
make install | |
docker-compose -f distribution/docker/docker-compose.yml logs -f & | |
sleep 15 | |
docker run --rm --network host -e ENDPOINT=http://localhost:8080 -e FORKS=2 -e BROWSER=firefox ghcr.io/tilblechschmidt/parallelseleniumtest:sha-fa30ad9 | |
docker run --rm --network host -e ENDPOINT=http://localhost:8080 -e FORKS=2 -e BROWSER=chrome ghcr.io/tilblechschmidt/parallelseleniumtest:sha-fa30ad9 | |
kubernetes-integration: | |
name: ☸️ Kubernetes integration test | |
runs-on: ubuntu-latest | |
needs: | |
- bundle-core | |
- bundle-node | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-core | |
path: ./ | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-node-firefox | |
path: ./ | |
- uses: actions/download-artifact@v2 | |
with: | |
name: docker-node-chrome | |
path: ./ | |
- name: Import docker images | |
run: | | |
docker load --input core.tar.gz | |
docker load --input node-firefox.tar.gz | |
docker load --input node-chrome.tar.gz | |
- name: Install dependencies | |
run: | | |
curl -fLO https://github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64 | |
chmod +x stern_linux_amd64 | |
sudo mv stern_linux_amd64 /usr/local/bin/stern | |
pip install selenium | |
- name: Start K8s cluster | |
run: | | |
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=777 sh -s - --docker | |
mkdir -p ~/.kube | |
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config | |
- name: Deploy WebGrid instance | |
run: | | |
stern --color always test-webgrid* & | |
helm install test ./distribution/kubernetes/demo/charts/webgrid --wait --set image.repository=ghcr.io/tilblechschmidt/webgrid,image.tag=sha-${GITHUB_SHA::7},image.pullPolicy=IfNotPresent | |
kubectl apply -f test/node-port.yml | |
- name: Print debug information | |
if: always() | |
run: | | |
kubectl cluster-info | |
kubectl get nodes | |
kubectl get jobs | |
kubectl get pods | |
kubectl get services | |
echo "------------------------ DESCRIBE ON PODS ------------------------" | |
kubectl describe pods | |
- name: Run integration test | |
run: | | |
docker run --rm --network host -e ENDPOINT=http://localhost:30007 -e FORKS=2 -e BROWSER=firefox ghcr.io/tilblechschmidt/parallelseleniumtest:sha-fa30ad9 | |
docker run --rm --network host -e ENDPOINT=http://localhost:30007 -e FORKS=2 -e BROWSER=chrome ghcr.io/tilblechschmidt/parallelseleniumtest:sha-fa30ad9 | |
# ------------------ RELEASE ONLY JOBS ------------------ | |
docker-hub: | |
if: github.event_name == 'release' | |
name: 🐳 Publish Images to DockerHub | |
runs-on: ubuntu-latest | |
needs: | |
- bundle-core | |
- bundle-node | |
- kubernetes-integration | |
- docker-integration | |
steps: | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: webgrid | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Prepare environment | |
run: | | |
echo "SRC_REPOSITORY=ghcr.io/tilblechschmidt/webgrid" >> $GITHUB_ENV | |
echo "SRC_TAG=sha-${GITHUB_SHA::7}" >> $GITHUB_ENV | |
echo "DST_REPOSITORY=webgrid" >> $GITHUB_ENV | |
echo "DST_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Cross-push core | |
run: | | |
SRC_IMAGE=${{ env.SRC_REPOSITORY }}/core:${{ env.SRC_TAG }} | |
DST_IMAGE=${{ env.DST_REPOSITORY }}/core:${{ env.DST_TAG }} | |
echo "Pushing $SRC_IMAGE to $DST_IMAGE" | |
docker pull $SRC_IMAGE | |
docker tag $SRC_IMAGE $DST_IMAGE | |
docker push $DST_IMAGE | |
- name: Cross-push node-firefox | |
run: | | |
SRC_IMAGE=${{ env.SRC_REPOSITORY }}/node-firefox:${{ env.SRC_TAG }} | |
DST_IMAGE=${{ env.DST_REPOSITORY }}/node-firefox:${{ env.DST_TAG }} | |
echo "Pushing $SRC_IMAGE to $DST_IMAGE" | |
docker pull $SRC_IMAGE | |
docker tag $SRC_IMAGE $DST_IMAGE | |
docker push $DST_IMAGE | |
- name: Cross-push node-chrome | |
run: | | |
SRC_IMAGE=${{ env.SRC_REPOSITORY }}/node-chrome:${{ env.SRC_TAG }} | |
DST_IMAGE=${{ env.DST_REPOSITORY }}/node-chrome:${{ env.DST_TAG }} | |
echo "Pushing $SRC_IMAGE to $DST_IMAGE" | |
docker pull $SRC_IMAGE | |
docker tag $SRC_IMAGE $DST_IMAGE | |
docker push $DST_IMAGE | |
publish-docs: | |
if: github.event_name == 'release' | |
name: 📚 Publish Docs to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: [build-core, docker-hub] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: core-documentation | |
path: .artifacts/core-documentation | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install mkdocs theme & plugins | |
run: | | |
pip3 install --no-cache \ | |
'mkdocs-git-revision-date-localized-plugin>=0.4' \ | |
'mkdocs-material' \ | |
'mkdocs-mermaid2-plugin' \ | |
'mkdocs-codeinclude-plugin' \ | |
'mkdocs-material-extensions' \ | |
'mkdocs-simple-hooks' \ | |
'git+http://github.com/TilBlechschmidt/mkdocs-helm' | |
- name: Build & deploy documentation | |
env: | |
HELM_USE_GIT_TAG: true | |
run: | | |
mkdocs --version | |
mkdocs gh-deploy --force | |
github-release: | |
if: github.event_name == 'release' | |
name: 🐙 Update GitHub Release | |
needs: [build-core] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: core-executable | |
path: .artifacts/core-executable | |
- name: Build release asset upload url | |
run: | | |
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH) | |
if [[ -z "${RELEASE_ID}" ]]; then | |
echo "There was no release ID in the GitHub event." | |
exit 1 | |
fi | |
RELEASE_ASSET_UPLOAD_URL="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" | |
echo "$RELEASE_ASSET_UPLOAD_URL" | |
echo "RELEASE_ASSET_UPLOAD_URL=$RELEASE_ASSET_UPLOAD_URL" >> $GITHUB_ENV | |
- name: Attach Core executable | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ env.RELEASE_ASSET_UPLOAD_URL }}?name=webgrid-core-linux | |
asset_path: .artifacts/core-executable/webgrid | |
asset_name: webgrid-core-linux | |
asset_content_type: application/octet-stream |