forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (40 loc) · 1.61 KB
/
ci-lint.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
name: CI
on: [push, pull_request]
permissions:
packages: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.20
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull and build Docker image
run: |
LOWERCASE_REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker pull ghcr.io/$LOWERCASE_REPO:builder-${{ github.ref_name }} || true
docker build --cache-from ghcr.io/$LOWERCASE_REPO:builder-${{ github.ref_name }} -t ghcr.io/$LOWERCASE_REPO:builder-${{ github.ref_name }} -f contrib/containers/ci/Dockerfile .
docker push ghcr.io/$LOWERCASE_REPO:builder-${{ github.ref_name }}
- name: Run lint-all.sh
run: |
LOWERCASE_REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace ghcr.io/$LOWERCASE_REPO:builder-${{ github.ref_name }} bash -c "chmod -R 777 /workspace && ./test/lint/lint-all.sh"