This commit is contained in:
@@ -1,71 +1,35 @@
|
|||||||
---
|
---
|
||||||
name: CI/CD Pipeline
|
name: CI/CD Pipeline
|
||||||
on:
|
on: push
|
||||||
push:
|
|
||||||
branches: [master, build-test]
|
|
||||||
pull_request:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
architecture: [amd64, arm64]
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '1.24'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y git
|
|
||||||
- name: Build go-away
|
|
||||||
run: |
|
|
||||||
mkdir .bin
|
|
||||||
go build -v -pgo=auto -v -trimpath -ldflags='-buildid= -bindnow' -buildmode pie -o ./.bin/go-away ./cmd/go-away
|
|
||||||
go build -v -trimpath -ldflags='-buildid= -bindnow' -buildmode pie -o ./.bin/test-wasm-runtime ./cmd/test-wasm-runtime
|
|
||||||
- name: Check policy for Forgejo
|
|
||||||
run: |
|
|
||||||
./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 --policy examples/forgejo.yml --policy-snippets examples/snippets/
|
|
||||||
- name: Check policy for Generic
|
|
||||||
run: |
|
|
||||||
./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 --policy examples/generic.yml --policy-snippets examples/snippets/
|
|
||||||
- name: Check policy for SPA
|
|
||||||
run: |
|
|
||||||
./.bin/go-away --check --slog-level DEBUG --backend example.com=http://127.0.0.1:80 --policy examples/spa.yml --policy-snippets examples/snippets/
|
|
||||||
- name: Test WASM Runtime Success
|
|
||||||
run: |
|
|
||||||
./.bin/test-wasm-runtime -wasm ./embed/challenge/js-pow-sha256/runtime/runtime.wasm -make-challenge ./embed/challenge/js-pow-sha256/test/make-challenge.json -make-challenge-out ./embed/challenge/js-pow-sha256/test/make-challenge-out.json -verify-challenge ./embed/challenge/js-pow-sha256/test/verify-challenge.json -verify-challenge-out 0
|
|
||||||
- name: Test WASM Runtime Fail
|
|
||||||
run: |
|
|
||||||
./.bin/test-wasm-runtime -wasm ./embed/challenge/js-pow-sha256/runtime/runtime.wasm -make-challenge ./embed/challenge/js-pow-sha256/test/make-challenge.json -make-challenge-out ./embed/challenge/js-pow-sha256/test/make-challenge-out.json -verify-challenge ./embed/challenge/js-pow-sha256/test/verify-challenge-fail.json -verify-challenge-out 1
|
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install docker
|
||||||
|
uses: papodaca/install-docker-action@main
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Git Forge registry
|
- name: Log in to Git Forge registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.projectsegfau.lt
|
registry: git.projectsegfau.lt
|
||||||
username: ${{ secrets.GIT_USERNAME }}
|
username: ${{ secrets.GIT_USERNAME }}
|
||||||
password: ${{ secrets.GIT_TOKEN }}
|
password: ${{ secrets.GIT_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
env:
|
uses: docker/build-push-action@v4
|
||||||
SOURCE_DATE_EPOCH: 0
|
with:
|
||||||
TZ: UTC
|
context: .
|
||||||
run: |-
|
file: ./Dockerfile
|
||||||
docker buildx build \
|
push: true
|
||||||
--platform linux/amd64,linux/arm64,linux/riscv64 \
|
tags: git.projectsegfau.lt/${{ secrets.GIT_USERNAME }}/go-away:latest
|
||||||
--tag git.projectsegfau.lt/${{ secrets.GIT_USERNAME }}/go-away:latest \
|
platforms: linux/amd64, linux/arm64
|
||||||
--push \
|
|
||||||
.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user