Skip to content

ci: fix tests and use SLE containers #42

ci: fix tests and use SLE containers

ci: fix tests and use SLE containers #42

Workflow file for this run

---
name: Package CI
# - this workflow will
# - test python version matrix [2.7, 3.6, 3.7, 3.8, 3.9] for coverage
# - uploads coverage data to codeClimate and the results are linked as a badges in the README
# - deliver the package content to the configured repository
# - submit the new package content to the upstream repository
on: [push, pull_request] # yamllint disable-line rule:truthy
env:
PACKAGE_NAME: python-shaptools
TAR_NAME: shaptools
jobs:
tab:
name: 'tabspace checking'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: tab
run: make test-tab
codespell:
name: 'spell checking'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get install -y git python3 python3-pip
python3 -m pip install codespell
- name: codespell
run: make test-codespell
shellcheck:
name: 'script syntax check'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get install -y git python3 python3-pip shellcheck
- name: shellcheck
run: make test-shellcheck
yamllint:
name: 'yaml linting'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get install -y git python3 python3-pip
python3 -m pip install codespell
- name: yamllint
run: make test-yamllint
jsonlint:
name: 'json linting'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get install -y git python3 python3-pip
python3 -m pip install jsonlint
- name: jsonlint
run: make test-jsonlint
mlc:
name: 'markup link checker'
runs-on: ubuntu-20.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
mkdir -p bin
curl -L https://github.com/becheran/mlc/releases/download/v0.14.3/mlc-x86_64-linux -o bin/mlc
chmod +x bin/mlc
echo "$PWD/bin" >> $GITHUB_PATH
- name: mlc
run: make test-mlc
python:
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Test python version [2.7, 3.6, 3.7, 3.8, 3.9] and install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov mock
- name: Test with pytest
run: make test-python
- name: Publish code coverage
uses: paambaati/[email protected]
if: ${{ env.CC_TEST_REPORTER_ID != null && github.event_name != 'pull_request' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: coverage.xml:coverage.py
delivery:
needs: [tab, codespell, shellcheck, yamllint, jsonlint, mlc, python]
runs-on: ubuntu-20.04
if: ${{ github.event_name != 'pull_request' }}
container:
image: shap/continuous_deliver
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
/scripts/init_osc_creds.sh
mkdir -p $HOME/.config/osc
cp /root/.config/osc/oscrc $HOME/.config/osc
- name: deliver package
run: |
sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \
/scripts/upload.sh
submit:
needs: [tab, codespell, shellcheck, yamllint, jsonlint, mlc, python, delivery]
runs-on: ubuntu-20.04
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
container:
image: shap/continuous_deliver
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT}}
TARGET_PROJECT: ${{ secrets.TARGET_PROJECT}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
/scripts/init_osc_creds.sh
mkdir -p $HOME/.config/osc
cp /root/.config/osc/oscrc $HOME/.config/osc
- name: submit package
run: |
sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \
/scripts/submit.sh