aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/dev-branch.yml
blob: 33172b0eb68c7bd00fa2ba3c201e4c6a6d984ede (plain) (blame)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Tests, analysis and push to dev dockerhub
on:
  push:
    branches:
      - dev
jobs:
  # This is done to prevent potential race conditions;
  # multiple jobs start with the source code, but since
  # they have no "needs", one could start a little bit later,
  # and in meantime a commit could be pushed
  Clone-repo:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: actions/upload-artifact@v3
        with:
          name: source-code
          path: .

  Tests:
    runs-on: ubuntu-latest
    needs: Clone-repo
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: source-code
          path: .
      - name: Run tests
        run: make tests
  
  Static-analysis:
    runs-on: ubuntu-latest
    needs: Clone-repo
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: source-code
          path: .
      - name: Run satic analysis
        run: make static-analysis

  Security-analysis:
    runs-on: ubuntu-latest
    needs: Clone-repo
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: source-code
          path: .
      - run: sudo apt-get install -y flawfinder
      - name: Run security analysis
        run: make security-analysis

  Build:
    runs-on: ubuntu-latest
    needs: [ Tests, Static-analysis, Security-analysis ]
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: source-code
          path: .
      - name: Build server and browser
        run: make dev
      - uses: actions/upload-artifact@v3
        with:
          name: dev-build-files
          path: ./build

  Build-docker-and-push:
    name: Build the docker container image and push it to dockerhub
    runs-on: ubuntu-latest
    needs: Build
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: dev-build-files
          path: ./build
      - run: sudo mv ./build /build
      - uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          push: true
          file: Dockerfile.dev
          tags: ${{ secrets.DOCKERHUB_USERNAME }}/pico-web-dev:latest