Migrate to cgroup2, debian:bookworm, Python 3.8+, aiohttp 3+, and ruamel.yaml 0.18.0+ #40
Workflow file for this run
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: Main | |
on: | |
push: ~ | |
pull_request: ~ | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
outputs: | |
sha_short: ${{ steps.vars.outputs.sha_short }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get variable | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Setup Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Setup pip cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-py3.8-pip--${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-py3.8-pip- | |
${{ runner.os }}-py3.8- | |
- name: Prepare environment | |
run: | | |
mkdir -p ~/.config/jd4 | |
cp examples/config.yaml examples/langs.yaml ~/.config/jd4/ | |
python -m pip install -r requirements.txt | |
python setup.py build_ext --inplace | |
- name: Unit test | |
run: python -m unittest -v jd4.case_test jd4.compare_test | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and export | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
tags: vijos/jd4:latest,vijos/jd4:${{ steps.vars.outputs.sha_short }} | |
outputs: type=docker,dest=/tmp/jd4.tar | |
- name: Integration test | |
run: | | |
docker load --input /tmp/jd4.tar | |
docker run --privileged --cgroupns=host \ | |
-v $(readlink -f examples/config.yaml):/root/.config/jd4/config.yaml \ | |
vijos/jd4 /bin/bash -c "source /venv/bin/activate && python3 -m unittest -v jd4.integration_test" | |
- name: Upload vijos/jd4 as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jd4-img | |
path: /tmp/jd4.tar | |
release: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: jd4-img | |
path: /tmp | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Load image | |
run: | | |
docker load --input /tmp/jd4.tar | |
docker image ls -a | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: vijos/jd4:latest,vijos/jd4:${{ needs.test.outputs.sha_short }} | |
- name: Release to GitHub | |
uses: ncipollo/release-action@v1 | |
with: | |
name: vijos/jd4:${{ needs.test.outputs.sha_short }} | |
artifacts: /tmp/jd4.tar | |
token: ${{ secrets.GITHUB_TOKEN }} | |
allowUpdates: true | |
tag: build-${{ needs.test.outputs.sha_short }} | |
commit: ${{ github.sha }} |