Commit 7616a1d
Antonio Mika
·
2026-10-11 16:58:48 -0400 EDT
parent d42eec7
ci: restore github actions
5 files changed,
+350,
-0
+70,
-0
| ... | ... | @@ -0,0 +1,70 @@ | |
| 1 | + | name: Run a docker build | |
| 2 | + | ||
| 3 | + | description: Runs a docker build in a composite action | |
| 4 | + | ||
| 5 | + | inputs: | |
| 6 | + | app: | |
| 7 | + | description: The pico app to build | |
| 8 | + | required: true | |
| 9 | + | platforms: | |
| 10 | + | description: The docker platforms to build for | |
| 11 | + | required: true | |
| 12 | + | default: | | |
| 13 | + | linux/amd64 | |
| 14 | + | linux/arm64 | |
| 15 | + | registry: | |
| 16 | + | description: The docker registry to use | |
| 17 | + | required: true | |
| 18 | + | default: ghcr.io | |
| 19 | + | web: | |
| 20 | + | description: Whether or not to build the web image | |
| 21 | + | required: true | |
| 22 | + | default: true | |
| 23 | + | type: boolean | |
| 24 | + | ssh: | |
| 25 | + | description: Whether or not to build the ssh image | |
| 26 | + | required: true | |
| 27 | + | default: true | |
| 28 | + | type: boolean | |
| 29 | + | ||
| 30 | + | runs: | |
| 31 | + | using: composite | |
| 32 | + | steps: | |
| 33 | + | - name: Collect web image metadata | |
| 34 | + | id: webmeta | |
| 35 | + | uses: docker/metadata-action@v4 | |
| 36 | + | with: | |
| 37 | + | images: ${{ inputs.REGISTRY }}/${{ github.repository }}/${{ inputs.app }}-web | |
| 38 | + | - name: Collect ssh image metadata | |
| 39 | + | id: sshmeta | |
| 40 | + | uses: docker/metadata-action@v4 | |
| 41 | + | with: | |
| 42 | + | images: ${{ inputs.REGISTRY }}/${{ github.repository }}/${{ inputs.app }}-ssh | |
| 43 | + | - name: Build and push web | |
| 44 | + | if: inputs.web == 'true' | |
| 45 | + | uses: docker/build-push-action@v3 | |
| 46 | + | with: | |
| 47 | + | context: . | |
| 48 | + | push: true | |
| 49 | + | tags: ${{ steps.webmeta.outputs.tags }} | |
| 50 | + | labels: ${{ steps.webmeta.outputs.labels }} | |
| 51 | + | target: release-web | |
| 52 | + | platforms: ${{ inputs.platforms }} | |
| 53 | + | cache-from: type=gha | |
| 54 | + | cache-to: type=gha,mode=max | |
| 55 | + | build-args: | | |
| 56 | + | APP=${{ inputs.app }} | |
| 57 | + | - name: Build and push ssh | |
| 58 | + | if: inputs.ssh == 'true' | |
| 59 | + | uses: docker/build-push-action@v3 | |
| 60 | + | with: | |
| 61 | + | context: . | |
| 62 | + | push: true | |
| 63 | + | tags: ${{ steps.sshmeta.outputs.tags }} | |
| 64 | + | labels: ${{ steps.sshmeta.outputs.labels }} | |
| 65 | + | target: release-ssh | |
| 66 | + | platforms: ${{ inputs.platforms }} | |
| 67 | + | cache-from: type=gha | |
| 68 | + | cache-to: type=gha,mode=max | |
| 69 | + | build-args: | | |
| 70 | + | APP=${{ inputs.app }} |
+34,
-0
| ... | ... | @@ -0,0 +1,34 @@ | |
| 1 | + | name: Setup main action | |
| 2 | + | ||
| 3 | + | description: Runs the setup required for docker building | |
| 4 | + | ||
| 5 | + | inputs: | |
| 6 | + | registry: | |
| 7 | + | description: The docker registry to use | |
| 8 | + | required: true | |
| 9 | + | default: ghcr.io | |
| 10 | + | username: | |
| 11 | + | description: The docker registry to use | |
| 12 | + | required: true | |
| 13 | + | password: | |
| 14 | + | description: The docker registry to use | |
| 15 | + | required: true | |
| 16 | + | ||
| 17 | + | runs: | |
| 18 | + | using: composite | |
| 19 | + | steps: | |
| 20 | + | - name: Set up QEMU | |
| 21 | + | uses: docker/setup-qemu-action@v2 | |
| 22 | + | with: | |
| 23 | + | platforms: all | |
| 24 | + | - name: Set up Docker Buildx | |
| 25 | + | id: buildx | |
| 26 | + | uses: docker/setup-buildx-action@v2 | |
| 27 | + | with: | |
| 28 | + | version: latest | |
| 29 | + | - name: Login to Docker Hub | |
| 30 | + | uses: docker/login-action@v2 | |
| 31 | + | with: | |
| 32 | + | registry: ${{ inputs.registry }} | |
| 33 | + | username: ${{ inputs.username }} | |
| 34 | + | password: ${{ inputs.password }} |
+20,
-0
| ... | ... | @@ -0,0 +1,20 @@ | |
| 1 | + | name: Lint and run tests | |
| 2 | + | ||
| 3 | + | description: Lints and runs tests on the codebase, used before builds and on every PR | |
| 4 | + | ||
| 5 | + | runs: | |
| 6 | + | using: composite | |
| 7 | + | steps: | |
| 8 | + | - name: Set up Go | |
| 9 | + | uses: actions/setup-go@v3 | |
| 10 | + | with: | |
| 11 | + | go-version-file: go.mod | |
| 12 | + | - name: Lint the codebase | |
| 13 | + | uses: golangci/golangci-lint-action@v8 | |
| 14 | + | with: | |
| 15 | + | version: latest | |
| 16 | + | - name: Run tests | |
| 17 | + | shell: bash | |
| 18 | + | run: | | |
| 19 | + | PICO_SECRET="danger" go test -v ./... -cover -race -coverprofile=coverage.out | |
| 20 | + | go tool cover -func=coverage.out -o=coverage.out |
+211,
-0
| ... | ... | @@ -0,0 +1,211 @@ | |
| 1 | + | name: Test and Build | |
| 2 | + | ||
| 3 | + | on: | |
| 4 | + | workflow_dispatch: | |
| 5 | + | push: | |
| 6 | + | branches: | |
| 7 | + | - main | |
| 8 | + | tags: | |
| 9 | + | - v* | |
| 10 | + | ||
| 11 | + | env: | |
| 12 | + | REGISTRY: ghcr.io | |
| 13 | + | PLATFORMS: | | |
| 14 | + | linux/amd64 | |
| 15 | + | linux/arm64 | |
| 16 | + | ||
| 17 | + | jobs: | |
| 18 | + | test: | |
| 19 | + | runs-on: ubuntu-22.04 | |
| 20 | + | steps: | |
| 21 | + | - name: Checkout repo | |
| 22 | + | uses: actions/checkout@v3 | |
| 23 | + | - name: Run tests and lint | |
| 24 | + | uses: ./.github/actions/test | |
| 25 | + | build-main: | |
| 26 | + | runs-on: ubuntu-22.04 | |
| 27 | + | needs: test | |
| 28 | + | strategy: | |
| 29 | + | matrix: | |
| 30 | + | APP: [prose, pastes, pgs, feeds, pipe] | |
| 31 | + | steps: | |
| 32 | + | - name: Checkout repo | |
| 33 | + | uses: actions/checkout@v3 | |
| 34 | + | - name: Setup docker | |
| 35 | + | uses: ./.github/actions/setup | |
| 36 | + | with: | |
| 37 | + | registry: ${{ env.REGISTRY }} | |
| 38 | + | username: ${{ github.actor }} | |
| 39 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 40 | + | - name: Run docker build for ${{ matrix.APP }} | |
| 41 | + | uses: ./.github/actions/build | |
| 42 | + | with: | |
| 43 | + | app: ${{ matrix.APP }} | |
| 44 | + | platforms: ${{ env.PLATFORMS }} | |
| 45 | + | registry: ${{ env.REGISTRY }} | |
| 46 | + | build-auth: | |
| 47 | + | runs-on: ubuntu-22.04 | |
| 48 | + | needs: test | |
| 49 | + | steps: | |
| 50 | + | - name: Checkout repo | |
| 51 | + | uses: actions/checkout@v3 | |
| 52 | + | - name: Setup docker | |
| 53 | + | uses: ./.github/actions/setup | |
| 54 | + | with: | |
| 55 | + | registry: ${{ env.REGISTRY }} | |
| 56 | + | username: ${{ github.actor }} | |
| 57 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 58 | + | - name: Run docker build for auth | |
| 59 | + | uses: ./.github/actions/build | |
| 60 | + | with: | |
| 61 | + | app: auth | |
| 62 | + | platforms: ${{ env.PLATFORMS }} | |
| 63 | + | registry: ${{ env.REGISTRY }} | |
| 64 | + | ssh: false | |
| 65 | + | build-pico: | |
| 66 | + | runs-on: ubuntu-22.04 | |
| 67 | + | needs: test | |
| 68 | + | steps: | |
| 69 | + | - name: Checkout repo | |
| 70 | + | uses: actions/checkout@v3 | |
| 71 | + | - name: Setup docker | |
| 72 | + | uses: ./.github/actions/setup | |
| 73 | + | with: | |
| 74 | + | registry: ${{ env.REGISTRY }} | |
| 75 | + | username: ${{ github.actor }} | |
| 76 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 77 | + | - name: Run docker build for pico | |
| 78 | + | uses: ./.github/actions/build | |
| 79 | + | with: | |
| 80 | + | app: pico | |
| 81 | + | platforms: ${{ env.PLATFORMS }} | |
| 82 | + | registry: ${{ env.REGISTRY }} | |
| 83 | + | web: false | |
| 84 | + | build-pgs-cdn: | |
| 85 | + | runs-on: ubuntu-22.04 | |
| 86 | + | needs: test | |
| 87 | + | steps: | |
| 88 | + | - name: Checkout repo | |
| 89 | + | uses: actions/checkout@v3 | |
| 90 | + | - name: Setup docker | |
| 91 | + | uses: ./.github/actions/setup | |
| 92 | + | with: | |
| 93 | + | registry: ${{ env.REGISTRY }} | |
| 94 | + | username: ${{ github.actor }} | |
| 95 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 96 | + | - name: Collect web image metadata | |
| 97 | + | id: pgscdnmeta | |
| 98 | + | uses: docker/metadata-action@v4 | |
| 99 | + | with: | |
| 100 | + | images: ${{ env.REGISTRY }}/${{ github.repository }}/pgs-cdn | |
| 101 | + | - name: Build and push | |
| 102 | + | uses: docker/build-push-action@v3 | |
| 103 | + | with: | |
| 104 | + | context: . | |
| 105 | + | file: Dockerfile.cdn | |
| 106 | + | push: true | |
| 107 | + | target: release-web | |
| 108 | + | tags: ${{ steps.pgscdnmeta.outputs.tags }} | |
| 109 | + | labels: ${{ steps.pgscdnmeta.outputs.labels }} | |
| 110 | + | platforms: ${{ env.PLATFORMS }} | |
| 111 | + | cache-from: type=gha | |
| 112 | + | cache-to: type=gha,mode=max | |
| 113 | + | build-pgs-standalone: | |
| 114 | + | runs-on: ubuntu-22.04 | |
| 115 | + | needs: test | |
| 116 | + | steps: | |
| 117 | + | - name: Checkout repo | |
| 118 | + | uses: actions/checkout@v3 | |
| 119 | + | - name: Setup docker | |
| 120 | + | uses: ./.github/actions/setup | |
| 121 | + | with: | |
| 122 | + | registry: ${{ env.REGISTRY }} | |
| 123 | + | username: ${{ github.actor }} | |
| 124 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 125 | + | - name: Collect web image metadata | |
| 126 | + | id: pgsstandalonemeta | |
| 127 | + | uses: docker/metadata-action@v4 | |
| 128 | + | with: | |
| 129 | + | images: ${{ env.REGISTRY }}/picosh/pgs | |
| 130 | + | - name: Build and push | |
| 131 | + | uses: docker/build-push-action@v3 | |
| 132 | + | with: | |
| 133 | + | context: . | |
| 134 | + | file: Dockerfile.standalone | |
| 135 | + | push: true | |
| 136 | + | target: release | |
| 137 | + | tags: ${{ steps.pgsstandalonemeta.outputs.tags }} | |
| 138 | + | labels: ${{ steps.pgsstandalonemeta.outputs.labels }} | |
| 139 | + | platforms: ${{ env.PLATFORMS }} | |
| 140 | + | cache-from: type=gha | |
| 141 | + | cache-to: type=gha,mode=max | |
| 142 | + | build-bouncer: | |
| 143 | + | runs-on: ubuntu-22.04 | |
| 144 | + | needs: test | |
| 145 | + | steps: | |
| 146 | + | - name: Checkout repo | |
| 147 | + | uses: actions/checkout@v3 | |
| 148 | + | - name: Get changed files | |
| 149 | + | id: changed-files | |
| 150 | + | uses: tj-actions/changed-files@v40 | |
| 151 | + | with: | |
| 152 | + | files: bouncer/** | |
| 153 | + | - name: Setup docker | |
| 154 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 155 | + | uses: ./.github/actions/setup | |
| 156 | + | with: | |
| 157 | + | registry: ${{ env.REGISTRY }} | |
| 158 | + | username: ${{ github.actor }} | |
| 159 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 160 | + | - name: Collect bouncer image metadata | |
| 161 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 162 | + | id: bouncermeta | |
| 163 | + | uses: docker/metadata-action@v4 | |
| 164 | + | with: | |
| 165 | + | images: ${{ env.REGISTRY }}/${{ github.repository }}/bouncer | |
| 166 | + | - name: Build and push | |
| 167 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 168 | + | uses: docker/build-push-action@v3 | |
| 169 | + | with: | |
| 170 | + | context: ./bouncer | |
| 171 | + | push: true | |
| 172 | + | tags: ${{ steps.bouncermeta.outputs.tags }} | |
| 173 | + | labels: ${{ steps.bouncermeta.outputs.labels }} | |
| 174 | + | platforms: ${{ env.PLATFORMS }} | |
| 175 | + | cache-from: type=gha | |
| 176 | + | cache-to: type=gha,mode=max | |
| 177 | + | build-caddy: | |
| 178 | + | runs-on: ubuntu-22.04 | |
| 179 | + | needs: test | |
| 180 | + | steps: | |
| 181 | + | - name: Checkout repo | |
| 182 | + | uses: actions/checkout@v3 | |
| 183 | + | - name: Get changed files | |
| 184 | + | id: changed-files | |
| 185 | + | uses: tj-actions/changed-files@v40 | |
| 186 | + | with: | |
| 187 | + | files: caddy/** | |
| 188 | + | - name: Setup docker | |
| 189 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 190 | + | uses: ./.github/actions/setup | |
| 191 | + | with: | |
| 192 | + | registry: ${{ env.REGISTRY }} | |
| 193 | + | username: ${{ github.actor }} | |
| 194 | + | password: ${{ secrets.GITHUB_TOKEN }} | |
| 195 | + | - name: Collect caddy image metadata | |
| 196 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 197 | + | id: caddymeta | |
| 198 | + | uses: docker/metadata-action@v4 | |
| 199 | + | with: | |
| 200 | + | images: ${{ env.REGISTRY }}/${{ github.repository }}/caddy | |
| 201 | + | - name: Build and push | |
| 202 | + | if: steps.changed-files.outputs.any_changed == 'true' | |
| 203 | + | uses: docker/build-push-action@v3 | |
| 204 | + | with: | |
| 205 | + | context: ./caddy | |
| 206 | + | push: true | |
| 207 | + | tags: ${{ steps.caddymeta.outputs.tags }} | |
| 208 | + | labels: ${{ steps.caddymeta.outputs.labels }} | |
| 209 | + | platforms: ${{ env.PLATFORMS }} | |
| 210 | + | cache-from: type=gha | |
| 211 | + | cache-to: type=gha,mode=max |
+15,
-0