|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | - releases/* |
| 8 | + - release/* |
8 | 9 | pull_request: |
9 | 10 | types: [ assigned, opened, synchronize, reopened, labeled ] |
10 | 11 |
|
11 | 12 | concurrency: |
12 | 13 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
13 | 14 | cancel-in-progress: true |
14 | | -permissions: |
15 | | - id-token: write |
16 | | - contents: read |
| 15 | + |
17 | 16 | jobs: |
18 | 17 | PR: |
19 | 18 | if: github.event_name == 'pull_request' |
20 | | - name: Check PR Title |
21 | | - runs-on: namespace-profile-linux-amd64-2vcpu |
| 19 | + uses: formancehq/ci/.github/workflows/go-pr.yml@main |
22 | 20 | permissions: |
| 21 | + pull-requests: read |
23 | 22 | statuses: write |
24 | | - steps: |
25 | | - - uses: amannn/action-semantic-pull-request@v6 |
26 | | - env: |
27 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
28 | 23 |
|
29 | 24 | Dirty: |
30 | 25 | runs-on: namespace-profile-linux-amd64-4vcpu |
31 | 26 | steps: |
32 | | - - uses: "namespacelabs/nscloud-checkout-action@v9" |
| 27 | + - uses: namespacelabs/nscloud-checkout-action@v9 |
33 | 28 | with: |
34 | 29 | fetch-depth: 0 |
35 | | - - name: Setup Nix |
36 | | - uses: ./.github/actions/default |
37 | | - with: |
38 | | - token: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
39 | | - - name: Pre-commit |
| 30 | + dissociate: true |
| 31 | + |
| 32 | + - uses: formancehq/ci/actions/setup-nix@main |
| 33 | + |
| 34 | + - run: nix develop --impure --command just pc |
40 | 35 | env: |
41 | 36 | GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
42 | | - run: nix develop --impure --command just pc |
| 37 | + |
43 | 38 | - name: Get changed files |
44 | | - id: changed-files |
45 | 39 | shell: bash |
46 | 40 | run: | |
47 | | - hasChanged=$(git status --porcelain) |
| 41 | + hasChanged=$(git status --porcelain) |
48 | 42 | if (( $(echo ${#hasChanged}) != 0 )); then |
49 | 43 | git status |
50 | 44 | echo "There are changes in the repository" |
51 | 45 | exit 1 |
52 | 46 | fi |
53 | 47 |
|
| 48 | + TestsUnit: |
| 49 | + name: Tests (Unit) |
| 50 | + needs: [Dirty] |
| 51 | + runs-on: namespace-profile-linux-amd64-4vcpu |
| 52 | + steps: |
| 53 | + - uses: namespacelabs/nscloud-checkout-action@v9 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + dissociate: true |
| 57 | + |
| 58 | + - uses: formancehq/ci/actions/setup-nix@main |
| 59 | + |
| 60 | + - run: nix develop --impure --command just tests-unit |
| 61 | + |
| 62 | + - uses: actions/upload-artifact@v7 |
| 63 | + with: |
| 64 | + name: coverage-unit-report |
| 65 | + path: ./coverage/unit_filtered.txt |
| 66 | + |
| 67 | + TestsIntegration: |
| 68 | + name: Tests (Integration) |
| 69 | + needs: [Dirty] |
| 70 | + runs-on: namespace-profile-linux-amd64-4vcpu |
| 71 | + steps: |
| 72 | + - uses: namespacelabs/nscloud-checkout-action@v9 |
| 73 | + with: |
| 74 | + fetch-depth: 0 |
| 75 | + dissociate: true |
| 76 | + |
| 77 | + - uses: formancehq/ci/actions/setup-nix@main |
| 78 | + |
| 79 | + - run: nix develop --impure --command just tests-integration |
| 80 | + |
| 81 | + - uses: actions/upload-artifact@v7 |
| 82 | + with: |
| 83 | + name: coverage-integration-report |
| 84 | + path: ./coverage/integration_filtered.txt |
54 | 85 |
|
55 | 86 | Tests: |
56 | | - runs-on: "namespace-profile-linux-amd64-2vcpu" |
| 87 | + runs-on: namespace-profile-linux-amd64-2vcpu |
57 | 88 | needs: |
58 | 89 | - TestsUnit |
59 | 90 | - TestsIntegration |
60 | 91 | steps: |
61 | | - - name: Download a report artifact |
62 | | - uses: actions/download-artifact@v8 |
| 92 | + - uses: actions/download-artifact@v8 |
63 | 93 | with: |
64 | 94 | pattern: coverage-* |
65 | 95 | merge-multiple: true |
66 | | - - name: Upload coverage reports to Codecov with GitHub Action |
67 | | - uses: codecov/codecov-action@v7.0.0 |
| 96 | + |
| 97 | + - uses: codecov/codecov-action@v7.0.0 |
68 | 98 | env: |
69 | 99 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
70 | 100 | with: |
71 | 101 | files: unit_filtered.txt,integration_filtered.txt |
72 | | - |
73 | | - TestsUnit: |
74 | | - name: Tests (Unit) |
75 | | - runs-on: namespace-profile-linux-amd64-4vcpu |
76 | | - steps: |
77 | | - - uses: "namespacelabs/nscloud-checkout-action@v9" |
78 | | - with: |
79 | | - fetch-depth: 0 |
80 | | - - name: Setup Nix |
81 | | - uses: ./.github/actions/default |
82 | | - with: |
83 | | - token: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
84 | | - - name: Pre-commit |
85 | | - run: nix develop --impure --command just tests-unit |
86 | | - - name: Archive code coverage results |
87 | | - uses: actions/upload-artifact@v7 |
88 | | - with: |
89 | | - name: coverage-unit-report |
90 | | - path: ./coverage/unit_filtered.txt |
91 | | - |
92 | | - TestsIntegration: |
93 | | - name: Tests (Integration) |
94 | | - runs-on: namespace-profile-linux-amd64-4vcpu |
95 | | - steps: |
96 | | - - uses: "namespacelabs/nscloud-checkout-action@v9" |
97 | | - with: |
98 | | - fetch-depth: 0 |
99 | | - - name: Setup Nix |
100 | | - uses: ./.github/actions/default |
101 | | - with: |
102 | | - token: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
103 | | - - name: Pre-commit |
104 | | - run: nix develop --impure --command just tests-integration |
105 | | - - name: Archive code coverage results |
106 | | - uses: actions/upload-artifact@v7 |
107 | | - with: |
108 | | - name: coverage-integration-report |
109 | | - path: ./coverage/integration_filtered.txt |
110 | 102 |
|
111 | 103 | GoReleaser: |
112 | | - runs-on: "namespace-profile-linux-amd64-4vcpu" |
113 | | - if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group' |
114 | | - steps: |
115 | | - - uses: "namespacelabs/nscloud-checkout-action@v9" |
116 | | - with: |
117 | | - fetch-depth: 0 |
118 | | - - name: Setup Nix |
119 | | - uses: ./.github/actions/default |
120 | | - with: |
121 | | - token: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
122 | | - - name: Login to GitHub Container Registry |
123 | | - uses: docker/login-action@v4 |
124 | | - with: |
125 | | - registry: ghcr.io |
126 | | - username: "NumaryBot" |
127 | | - password: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
128 | | - - run: > |
129 | | - nix develop --impure --command just release-ci |
| 104 | + needs: [Dirty] |
| 105 | + uses: formancehq/ci/.github/workflows/go-build.yml@main |
| 106 | + with: |
| 107 | + build-condition: main-and-label |
| 108 | + build-label: build-images |
| 109 | + secrets: |
| 110 | + NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
| 111 | + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
130 | 112 |
|
131 | | - env: |
132 | | - GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} |
133 | | - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
134 | | - |
135 | 113 | Deploy: |
136 | | - runs-on: ubuntu-24.04 |
| 114 | + runs-on: namespace-profile-linux-amd64-2vcpu |
137 | 115 | if: github.ref == 'refs/heads/main' |
138 | 116 | environment: staging |
| 117 | + permissions: |
| 118 | + id-token: write |
139 | 119 | needs: |
140 | 120 | - GoReleaser |
141 | 121 | - Dirty |
142 | 122 | - Tests |
143 | 123 | steps: |
144 | | - - uses: earthly/actions-setup@v1 |
145 | | - with: |
146 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
147 | | - version: "latest" |
148 | | - - uses: 'actions/checkout@v7' |
| 124 | + - uses: formancehq/ci/actions/deploy-staging@main |
149 | 125 | with: |
150 | | - fetch-depth: 0 |
151 | | - - name: Tailscale |
152 | | - uses: tailscale/github-action@v4 |
153 | | - with: |
154 | | - oauth-client-id: ${{ secrets.TS_OIDC_OAUTH_CLIENT_ID }} |
155 | | - audience: ${{ secrets.TS_OIDC_AUDIENCE }} |
156 | | - tags: ${{ vars.TS_TAGS }} |
157 | | - version: ${{ vars.TS_VERSION }} |
158 | | - args: ${{ vars.TS_ARGS }} |
159 | | - retry: ${{ vars.TS_RETRY }} |
160 | | - timeout: ${{ vars.TS_TIMEOUT }} |
161 | | - ping: ${{ vars.TS_PING }} |
162 | | - - name: "Deploy in staging" |
163 | | - env: |
164 | | - TAG: ${{ github.sha }} |
165 | | - COMPONENT: agent |
166 | | - ARGOCD_REGION_AUTH_TOKEN: ${{ secrets.ARGOCD_REGION_AUTH_TOKEN }} |
167 | | - run: > |
168 | | - earthly |
169 | | - --no-output |
170 | | - --secret AUTH_TOKEN=$ARGOCD_REGION_AUTH_TOKEN |
171 | | - +deploy-staging |
172 | | - --TAG=$TAG |
173 | | - --COMPONENT=$COMPONENT |
| 126 | + component: agent |
| 127 | + tag: ${{ github.sha }} |
| 128 | + auth-token: ${{ secrets.ARGOCD_REGION_AUTH_TOKEN }} |
| 129 | + ts-oauth-client-id: ${{ secrets.TS_OIDC_OAUTH_CLIENT_ID }} |
| 130 | + ts-audience: ${{ secrets.TS_OIDC_AUDIENCE }} |
| 131 | + ts-tags: ${{ vars.TS_TAGS }} |
| 132 | + ts-version: ${{ vars.TS_VERSION }} |
| 133 | + ts-args: ${{ vars.TS_ARGS }} |
| 134 | + ts-retry: ${{ vars.TS_RETRY }} |
| 135 | + ts-timeout: ${{ vars.TS_TIMEOUT }} |
| 136 | + ts-ping: ${{ vars.TS_PING }} |
0 commit comments