2024-12-17 11:06:23 +09:00
|
|
|
name: Tests
|
2024-10-17 00:18:20 +09:00
|
|
|
|
|
|
|
on:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2024-12-17 11:06:23 +09:00
|
|
|
name: Go tests
|
2024-10-17 00:18:20 +09:00
|
|
|
runs-on: ubuntu-latest
|
2024-12-06 03:34:13 +09:00
|
|
|
container:
|
|
|
|
image: node:16-bookworm-slim
|
2024-10-17 00:18:20 +09:00
|
|
|
steps:
|
2024-12-18 22:00:08 +09:00
|
|
|
- name: Enable backports
|
|
|
|
run: >-
|
|
|
|
echo 'deb http://deb.debian.org/debian bookworm-backports main' >> /etc/apt/sources.list.d/backports.list
|
|
|
|
if: ${{ runner.os == 'Linux' }}
|
|
|
|
|
|
|
|
- name: Ensure environment
|
2024-12-06 03:34:13 +09:00
|
|
|
run: >-
|
2024-12-18 22:00:08 +09:00
|
|
|
apt-get update && apt-get install -y curl wget sudo libxml2
|
|
|
|
if: ${{ runner.os == 'Linux' }}
|
|
|
|
|
|
|
|
- name: Get dependencies
|
|
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
|
|
with:
|
|
|
|
packages: acl git gcc pkg-config libwayland-dev wayland-protocols/bookworm-backports libxcb1-dev libacl1-dev
|
|
|
|
version: 1.0
|
|
|
|
#execute_install_scripts: true
|
2024-12-06 03:34:13 +09:00
|
|
|
if: ${{ runner.os == 'Linux' }}
|
|
|
|
|
2024-10-17 00:18:20 +09:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Setup go
|
|
|
|
uses: https://github.com/actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: '>=1.23.0'
|
|
|
|
|
2024-12-06 03:34:13 +09:00
|
|
|
- name: Go generate
|
2024-10-17 00:18:20 +09:00
|
|
|
run: >-
|
2024-12-06 03:34:13 +09:00
|
|
|
go generate ./...
|
2024-10-17 00:18:20 +09:00
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: >-
|
|
|
|
go test ./...
|
|
|
|
|
2024-12-18 19:57:03 +09:00
|
|
|
- name: Build for test
|
|
|
|
id: build-test
|
2024-10-17 00:18:20 +09:00
|
|
|
run: >-
|
2024-12-18 19:57:03 +09:00
|
|
|
FORTIFY_VERSION="$(git rev-parse --short HEAD)"
|
|
|
|
bash -c './dist/release.sh &&
|
|
|
|
echo "rev=$FORTIFY_VERSION" >> $GITHUB_OUTPUT'
|
|
|
|
|
|
|
|
- name: Upload test build
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: "fortify-${{ steps.build-test.outputs.rev }}"
|
|
|
|
path: dist/fortify-*
|
|
|
|
retention-days: 1
|