-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.95 KB
/
Copy pathtests.yml
File metadata and controls
57 lines (49 loc) · 1.95 KB
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
name: "All Tests"
on: [push]
env:
PATH_MOUNT: /workspaces/sqiima
PATH_CACHE: /tmp/docker-img-arch
jobs:
Tests:
runs-on: ubuntu-latest
name: Lint, static analysis, unit test of Go and Shell script
steps:
- name: Check out repo under workspace
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create image tag
id: imagetag
run: |
HASH_IMAGE=${{ hashFiles('./.devcontainer/Dockerfile') }}
VARIANT=$(TZ=UTC-9 date '+%Y%m')${HASH_IMAGE:0:7}
TAG=test:${VARIANT}
NAME_TAR="${VARIANT}.tar"
PATH_TAR=${{ env.PATH_CACHE }}"/${NAME_TAR}"
: # Export variables
echo "::set-output name=TAG::${TAG}"
echo "::set-output name=PATH_TAR::${PATH_TAR}"
- name: Cache or restore image archive
id: cache
uses: actions/cache@v2
with:
path: ${{ env.PATH_CACHE }}
key: ${{ steps.imagetag.outputs.TAG }}
- name: Load Docker image if exists
if: steps.cache.outputs.cache-hit == 'true'
run: docker load --input ${{ steps.imagetag.outputs.PATH_TAR }}
- name: Build Docker image and save
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.PATH_CACHE }}
docker pull ghcr.io/keinos/vscode-dev-container-go:latest
docker build -f './.devcontainer/Dockerfile' -t ${{ steps.imagetag.outputs.TAG }} .
docker save --output ${{ steps.imagetag.outputs.PATH_TAR }} ${{ steps.imagetag.outputs.TAG }}
- name: Run tests for both Go and ShellScript
run: |
path_entrypoint=${{ env.PATH_MOUNT }}/.github/workflows/entrypoint.sh
docker run -u root -v "$(pwd)":${{ env.PATH_MOUNT }} -w ${{ env.PATH_MOUNT }} ${{ steps.imagetag.outputs.TAG }} "$path_entrypoint"
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}