Merge branch 'fix/missing-manifest-error' into 'v3' #173
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: build and test | |
on: [push] | |
env: | |
CONTAINER_REGISTRY: ghcr.io | |
CONTAINER_REGISTRY_REPO: ghcr.io/${{ github.repository_owner }} | |
CONTAINER_REGISTRY_USER: ${{ secrets.CONTAINER_REGISTRY_USER }} | |
CONTAINER_REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
DOCKER_IMAGE_NAME: kolga | |
BUILD_HOST_IMAGE: ghcr.io/andersinno/kolga:v3 | |
BUILT_DOCKER_TEST_IMAGE: ghcr.io/${{ github.repository_owner }}/kolga:${{ github.sha }}-development | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: login to Docker container registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.CONTAINER_REGISTRY }} | |
username: ${{ env.CONTAINER_REGISTRY_USER }} | |
password: ${{ env.CONTAINER_REGISTRY_PASSWORD }} | |
- name: pull Kólga Docker image | |
run: docker pull $BUILD_HOST_IMAGE | |
- name: ensure lowercase image | |
run: | | |
echo BUILT_DOCKER_TEST_IMAGE=$(echo ${{ env.BUILT_DOCKER_TEST_IMAGE }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
echo CONTAINER_REGISTRY_REPO=$(echo ${{ env.CONTAINER_REGISTRY_REPO }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: use Kólga to build Kólga | |
id: build | |
run: | | |
env > ./.docker-env | |
docker run --env-file .docker-env --workdir /github/workspace --rm -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "$PWD":"/github/workspace" \ | |
$BUILD_HOST_IMAGE bash -c './devops create_images && export BUILT_IMAGE=$(./devops docker_test_image)' | |
test: | |
runs-on: ubuntu-20.04 | |
needs: [build] | |
strategy: | |
matrix: | |
tests: ["style-tests", "typing-tests", "package-tests", "docs", "test"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: ensure lowercase image | |
run: | | |
echo BUILT_DOCKER_TEST_IMAGE=$(echo ${{ env.BUILT_DOCKER_TEST_IMAGE }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
echo CONTAINER_REGISTRY_REPO=$(echo ${{ env.CONTAINER_REGISTRY_REPO }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: ${{ matrix.tests }} | |
run: | | |
if [[ "${{ matrix.tests }}" == "test" ]] | |
then | |
sudo sysctl -w net/netfilter/nf_conntrack_max=131072 | |
sudo chown $(whoami) /etc/hosts && echo 127.0.0.1 docker-registry >> /etc/hosts | |
make ${{ matrix.tests }} | |
else | |
docker run -v "$GITHUB_WORKSPACE":/app ${{ env.BUILT_DOCKER_TEST_IMAGE }} /bin/bash -c "make ${{ matrix.tests }}" | |
fi | |
if: always() |