Updated ID patterns to align with STE students. #61
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: Unit Tests | |
on: | |
push: | |
paths: | |
- 'setup.py' | |
- 'environment.yml' | |
- 'xdufacool/**' | |
- 'tests/**' | |
jobs: | |
testing: | |
runs-on: ubuntu-${{ matrix.os }} | |
strategy: | |
matrix: | |
python: [3.8, 3.9] | |
os: [20.04, 22.04] | |
env: | |
LOG_FILE: ubuntu-${{ matrix.os }}-py${{ matrix.python }}.log | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup mini-conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: xdufacool | |
environment-file: environment.yml | |
python-version: ${{ matrix.python }} | |
auto-activate-base: false | |
# - name: Lint with flake8 | |
# run: | | |
# pip install flake8 | |
# # stop the build if there are Python syntax errors or undefined names | |
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Unit Tests | |
run: | | |
python3 -m unittest discover -v > ${{ env.LOG_FILE }} | |
continue-on-error: true | |
- name: Upload logs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs | |
path: ${{ env.LOG_FILE }} | |
# - name: Slack Notification | |
# uses: rtCamp/action-slack-notify@master | |
# if: ${{ always() }} | |
# env: | |
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
# SLACK_CHANNEL: teaching | |
# SLACK_ICON_EMOJI: ':mailbox:' | |
# SLACK_USERNAME: 'GitHub Action Bot' | |
# SLACK_COLOR: 'good' | |
# SLACK_TITLE: ${{ github.workflow }} | |
# SLACK_MESSAGE: "${{ github.workflow }} ${{ job.status }} with Python ${{ matrix.python-version }} on ${{ runner.os }}." | |
# SLACK_FOOTER: '' | |
slack: | |
runs-on: ubuntu-latest | |
name: Notification | |
needs: testing | |
env: | |
REPO_NAME: ${{ github.event.repository.name }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: logs | |
- name: Collect compiled slides | |
run: | | |
ls *.log | sed -e 's/^/:white_check_mark: /g' | xargs > files.txt | |
cat files.txt | |
DOCS="\"$(sed -e 's/.log /", "/g' -e 's/.log//g' files.txt)\"" | |
echo ${DOCS} | |
echo "docs={'logs': [${DOCS}]}" >> $GITHUB_ENV | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@master | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_ICON_EMOJI: ':mailbox:' | |
SLACK_CHANNEL: teaching | |
SLACK_COLOR: 'success' | |
SLACK_USERNAME: GitHub Action Bot | |
SLACK_TITLE: ${{ env.REPO_NAME }} Unit Tests | |
SLACK_MESSAGE: "${{ join(fromJSON(env.docs).logs, '\n') }}" | |
SLACK_FOOTER: 'triggered by ${{ github.sha }}' | |
MSG_MINIMAL: true | |