-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (72 loc) · 2.49 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: build
on: [push, workflow_dispatch]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Run linter
uses: psf/black@stable
test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage codecov -r requirements.txt -r requirements-tests.txt
- name: Get tokens
run: mkdir env && echo $XBL_TOKENE | base64 --decode > env/tokens.json
env:
XBL_TOKENE: ${{ secrets.XBL_TOKENE }}
- name: Run tests
run: PYTHONUNBUFFERED=TRUE XBLAPI_RUN_COVERAGE=1 pytest -s
env:
XBL_CID: ${{ secrets.XBL_CID }}
XBL_CSEC: ${{ secrets.XBL_CSEC }}
XBL_TOKENS_PATH: env/tokens.json
- name: Remove tokens
run: rm -r env/
- name: Report coverage
run: codecov
docker:
needs: test
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Login to Docker Hub
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
if: github.ref == 'refs/heads/master'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: List Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Run buildx
# linux/ppc64le, linux/s390x: Cargo not detected
# linux/arm/v6: "qemu-arm: Could not open '/lib/ld-linux-armhf.so.3': No such file or directory"
# linux/386: rustup downloads x86_64 installer
run: |
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--output "type=image,push=$([[ $GITHUB_REF == "refs/heads/master" ]] && echo true || echo false)" \
--build-arg GIT_COMMIT=$GITHUB_SHA -t jcxldn/xbl-web-api:latest .