gha: Fix publish #168
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 | |
on: | |
push: | |
branches: | |
- master | |
- next | |
pull_request: | |
branches: | |
- master | |
- next | |
workflow_dispatch: | |
jobs: | |
shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run ShellCheck for host scripts (POSIX) | |
uses: ludeeus/[email protected] | |
with: | |
additional_files: 'lint mkconfig pyrex-init-build-env' | |
ignore: 'image' | |
env: | |
SHELLCHECK_OPTS: -s sh -e SC1090 -e SC2181 -e SC3054 | |
- name: Run ShellCheck for container scripts (bash) | |
uses: ludeeus/[email protected] | |
with: | |
scandir: 'image' | |
env: | |
SHELLCHECK_OPTS: -s bash -e SC1090 -e SC2181 | |
check: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.6 | |
- name: Install python packages | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install \ | |
black \ | |
flake8 | |
- name: Run black | |
run: | | |
black --check $(git ls-files '*.py') | |
- name: Run flake8 | |
run: | | |
flake8 $(git ls-files '*.py') | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {image: ubuntu-14.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-14.04-oe, provider: docker, sh: bash} | |
- {image: ubuntu-14.04-oegarmin, provider: docker, sh: bash} | |
- {image: ubuntu-16.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-16.04-oe, provider: docker, sh: bash} | |
- {image: ubuntu-16.04-oegarmin, provider: docker, sh: bash} | |
- {image: ubuntu-18.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-18.04-oe, provider: docker, sh: zsh } | |
- {image: ubuntu-18.04-oetest, provider: docker, sh: bash} | |
- {image: ubuntu-18.04-oegarmin, provider: docker, sh: bash} | |
- {image: ubuntu-20.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-20.04-oe, provider: docker, sh: bash} | |
- {image: ubuntu-20.04-oetest, provider: docker, sh: bash} | |
- {image: ubuntu-20.04-oegarmin, provider: docker, sh: bash} | |
- {image: ubuntu-22.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-22.04-oe, provider: docker, sh: bash} | |
- {image: ubuntu-22.04-oegarmin, provider: docker, sh: bash} | |
- {image: ubuntu-24.04-base, provider: docker, sh: bash} | |
- {image: ubuntu-24.04-oe, provider: docker, sh: bash} | |
- {image: ubuntu-24.04-oegarmin, provider: docker, sh: bash} | |
runs-on: ubuntu-20.04 | |
permissions: | |
packages: write | |
contents: read | |
env: | |
USE_HELPER: "1" | |
DOCKER_BUILDKIT: "1" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.6 | |
- name: Prepare build | |
run: ./ci/prepare.sh | |
- name: Install packages | |
run: | | |
sudo mkdir -p /etc/containers/ | |
echo '{ "features": { "buildkit": true } }' | sudo tee /etc/docker/daemon.json | |
sudo apt -y install \ | |
diffstat \ | |
fuse-overlayfs \ | |
zsh | |
- name: ${{ matrix.provider }} info | |
run: ${{ matrix.provider }} info | |
- name: Install python packages | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install coverage | |
- name: Build image | |
run: | | |
./ci/build_image.py ${{ matrix.image }} --provider=${{ matrix.provider }} | |
- name: ${{ matrix.provider }} images | |
run: ${{ matrix.provider }} images | |
- name: Test image | |
run: | | |
export PYTHONPATH=${GITHUB_WORKSPACE}/ci/site/:$PYTHONPATH | |
export COVERAGE_PROCESS_START=${GITHUB_WORKSPACE}/.coveragerc | |
rm -f .coverage-report.* | |
export SHELL=${{ matrix.sh }} | |
$SHELL -c "./ci/test.py -vb PyrexImage_${{ matrix.provider }}_$(echo ${{ matrix.image }} | sed 's/\W/_/g')" | |
- name: Combine coverage | |
run: | | |
coverage3 combine | |
- name: Login to ghcr.io | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
if: ${{ ( github.ref == 'refs/heads/next' || github.ref == 'refs/heads/master' ) && github.event_name == 'push' && matrix.provider == 'docker' }} | |
- name: Push image | |
run: | | |
TAG="${GITHUB_REF##*/}" | |
if [ "$TAG" = "master" ]; then | |
TAG="latest" | |
fi | |
docker tag ghcr.io/garmin/${{ matrix.image }}:ci-test ghcr.io/garmin/${{ matrix.image }}:$TAG | |
docker push ghcr.io/garmin/${{ matrix.image }}:$TAG | |
if: ${{ ( github.ref == 'refs/heads/next' || github.ref == 'refs/heads/master' ) && github.event_name == 'push' && matrix.provider == 'docker' }} |