Skip to content

Commit

Permalink
Add GitHub Actions workflow for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sjohannes committed Nov 20, 2020
1 parent b418452 commit b6edb61
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Exaile CI

on: [push, pull_request]

jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: pip install black
- name: Check format
run: make check_format

test:
strategy:
matrix:
imgtag:
- debian10-python3
- fedora31-python3
- ubuntu18.04-python3
- ubuntu19.10-python3
runs-on: ubuntu-latest
container: exaile/exaile-testimg:${{ matrix.imgtag }}
steps:
- uses: actions/checkout@v2
- name: Build and run tests
# The container always runs as root regardless of how we set it up in
# the Dockerfile. Exaile has tests for file permissions that fail in
# that setup, so we de-escalate manually here.
run: |
useradd -MN exaile
chown -R exaile .
export HOME=/tmp/home
su -m exaile -c "make BUILDDIR=/tmp/build test test_compile check-doc"
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y --no-install-recommends python3-gi
- id: dist
name: Create source dist archive
run: |
version=${GITHUB_REF#refs/*/}
printf '::set-output name=version::%s\n' "${version}"
make DIST_VERSION="$version" dist
checksum=$(cd dist && sha256sum --tag *)
printf '::set-output name=checksum::%s\n' "${checksum}"
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version='${{ steps.dist.outputs.version }}'
notes='```
${{ steps.dist.outputs.checksum }}
```'
gh release create \
"${version}" \
"dist/exaile-${version}.tar.gz" \
--draft \
--title "Exaile ${version}" \
--notes "${notes}"
notify:
if: failure() && github.repository_owner == 'exaile'
needs: [lint, test, deploy]
runs-on: ubuntu-latest
steps:
# TODO: Make this send IRC message
- name: Print status
run: |
printf "%s | lint %s | test %s | deploy %s\n" \
"${GITHUB_REF#refs/*/}" \
'${{ needs.lint.result }}' \
'${{ needs.test.result }}' \
'${{ needs.lint.result }}'

0 comments on commit b6edb61

Please sign in to comment.