summaryrefslogtreecommitdiff
path: root/.forgejo/workflows/test.yml
blob: fa3ac0744e99793d4aefa1dcce48d679f276739a (plain)
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
env:
    BUILD_DEPENDENCIES: apt-transport-https curl git iproute2 lsb-release make wget
    GOCILINT_VERSION: 1.62.0
on: [ push ]

jobs:
  test:
    runs-on: docker
    container:
      image: debian:latest
    steps:
      - name: Install OS Dependencies
        run: |
          apt-get update
          apt-get install --yes $BUILD_DEPENDENCIES
      - name: Enable Go Backports
        run: |
          wget -O /usr/share/keyrings/go+repo@tuxed.net.gpg https://repo.tuxed.net/golang/v1/deb/go+repo@tuxed.net.gpg
          echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/go+repo@tuxed.net.gpg] https://repo.tuxed.net/golang/v1/deb $(lsb_release -c -s) main" > /etc/apt/sources.list.d/golang_v1.list
          apt-get update
          apt-get install --yes golang-go
      - name: Install linter
        run: |
          wget -O lint.deb https://github.com/golangci/golangci-lint/releases/download/v$GOCILINT_VERSION/golangci-lint-$GOCILINT_VERSION-linux-amd64.deb
          dpkg -i lint.deb
          rm lint.deb
      - name: Clone Repository
        run: |
          mkdir app
          git clone -b ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} app
      - name: Download Go deps
        run: |
          cd app
          go get ./...
      - name: Test Go
        run: |
          cd app
          unshare -r -n bash -c "ip link set lo up && make test"
      - name: Lint
        run: |
          cd app
          make lint