[Chore] Replace buildkite ci with github-actions

This commit is contained in:
Philipp Herzog 2023-01-16 15:15:43 +01:00 committed by Roman Melnikov
parent 86d9409e88
commit 40a2451105
No known key found for this signature in database
GPG Key ID: 8931E8ED1EE2E537
6 changed files with 132 additions and 61 deletions

View File

@ -1,56 +0,0 @@
# SPDX-FileCopyrightText: 2019-2021 Serokell <https://serokell.io>
#
# SPDX-License-Identifier: MPL-2.0
steps:
- command: nix flake check -L --allow-import-from-derivation
label: Check flake
- label: shellcheck
command: nix shell .#shellcheck -c find . -name '*.sh' -exec shellcheck {} +
- label: stylish
command: nix shell .#gnumake .#stylish-haskell -c ./scripts/validate-stylish.sh
- command: nix build -L .#"xrefcheck:lib:xrefcheck" .#"xrefcheck:test:ftp-tests" .#"xrefcheck:test:xrefcheck-tests"
label: Library and tests
- command: nix shell .#bats .#diffutils .#xrefcheck-static -c bash -c "cd tests/golden/ && bats ./**"
label: Golden tests (bats)
- command: nix build -L .#xrefcheck-static
label: Executable
artifact_paths:
- "result/bin/xrefcheck"
- command: nix build -L .#xrefcheck-windows
label: Windows executable
artifact_paths:
- "result/bin/*"
- command: nix run . -L
label: Xrefcheck itself
retry:
automatic:
limit: 2
- label: lint
command: nix shell .#haskellPackages.hlint -c hlint .
- command:
- nix shell .#curl .#gitAndTools.hub -c bash -c "curl https://raw.githubusercontent.com/serokell/scratch/release-binary/scripts/release-binary.sh | bash"
label: Create a pre-release
branches: master
- command:
- nix build -L .#docker-image
- nix shell .#skopeo -c ./scripts/upload-docker-image.sh "docker-archive:$(readlink result)" "docker://docker.io/serokell/xrefcheck:latest"
label: Push to dockerhub
branches: master
- command:
- nix build .#docker-image
- nix shell .#skopeo -c ./scripts/upload-docker-image.sh "docker-archive:$(readlink result)" "docker://docker.io/serokell/xrefcheck:${BUILDKITE_BRANCH}"
label: Push release to dockerhub
if: |
build.tag =~ /^v[0-9]+.*/

27
.github/workflows/autorelease.yml vendored Normal file
View File

@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2023 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
name: master-update
on:
push:
branches:
- master
jobs:
release:
runs-on: [self-hosted, nix]
steps:
- uses: actions/checkout@v3
- name: Create a pre-release
run: |
export GITHUB_TOKEN=${{ env.GITHUB_TOKEN }}
nix shell .#curl .#gitAndTools.hub -c bash -c "curl https://raw.githubusercontent.com/serokell/scratch/release-binary/scripts/release-binary.sh | bash"
- name: Push latest image to dockerhub
run: |
export DOCKERHUB_PASSWORD=${{ env.DOCKERHUB_PASSWORD }}
nix build -L .#docker-image
nix shell .#skopeo -c ./scripts/upload-docker-image.sh "docker-archive:$(readlink result)" "docker://docker.io/serokell/xrefcheck:latest"

View File

@ -10,10 +10,36 @@
name: CI
on: [push]
on: [pull_request]
jobs:
xrefcheck-build-and-test:
validate:
runs-on: [self-hosted, nix]
steps:
- uses: actions/checkout@v3
- name: reuse
run: nix build -L .#checks.x86_64-linux.reuse-lint
# Run step even if the previous one has failed
if: success() || failure()
- name: hlint
run: nix build -L .#checks.x86_64-linux.hlint
if: success() || failure()
- name: shellcheck
run: nix build -L .#checks.x86_64-linux.shellcheck
if: success() || failure()
- name: stylish-haskell
run: nix build -L .#checks.x86_64-linux.stylish-haskell
if: success() || failure()
- name: check-trailing-whitespace
run: nix build -L .#checks.x86_64-linux.trailing-whitespace
if: success() || failure()
xrefcheck-build-and-test-windows:
runs-on: windows-latest
strategy:
matrix:
@ -27,7 +53,7 @@ jobs:
with:
submodules: 'true'
- uses: haskell/actions/setup@v2.0.1
- uses: haskell/actions/setup@v2.4.3
id: setup-haskell-stack
name: Setup Haskell Stack
with:
@ -79,3 +105,47 @@ jobs:
export PATH=$PATH:/c/Users/runneradmin/AppData/Roaming/local/bin;
bats ./tests/golden/**
shell: bash
xrefcheck-build-and-test-nix:
runs-on: [self-hosted, nix]
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build
run: nix build -L .#xrefcheck
- name: test
run: nix build -L .#checks.x86_64-linux.test
- name: Golden tests (bats)
run: nix shell .#bats .#diffutils .#xrefcheck -c bash -c "cd tests/golden/ && bats ./**"
- name: windows cross-compilation
run: |
nix build -L .#xrefcheck-windows
echo "WINDOWS_BINARY_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload windows executable
uses: actions/upload-artifact@v3
with:
name: xrefcheck-windows
path: ${{ env.WINDOWS_BINARY_PATH }}/bin/*
- name: docker-image
run: nix build -L .#docker-image
- name: static binary
run: |
nix build -L .#xrefcheck-static
echo "STATIC_BINARY_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: Upload static binary
uses: actions/upload-artifact@v3
with:
name: xrefcheck-static
path: ${{ env.STATIC_BINARY_PATH }}/bin/xrefcheck
- name: Xrefcheck itself
run: nix run . -L

22
.github/workflows/dockerhub-release.yml vendored Normal file
View File

@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: 2023 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
name: dockerhub-release
on:
push:
tags:
- v[0-9]+.*
jobs:
dockerhub-release:
runs-on: [self-hosted, nix]
steps:
- uses: actions/checkout@v3
- name: Push release image to dockerhub
run: |
export DOCKERHUB_PASSWORD=${{ env.DOCKERHUB_PASSWORD }}
nix build .#docker-image
nix shell .#skopeo -c ./scripts/upload-docker-image.sh "docker-archive:$(readlink result)" "docker://docker.io/serokell/xrefcheck:${{ github.ref_name }}"

View File

@ -6,7 +6,7 @@
# Xrefcheck
[![Build status](https://badge.buildkite.com/75461331a6058b334383cdfca1071dc1f908b70cf069d857b7.svg?branch=master)](https://buildkite.com/serokell/xrefcheck)
![Build status](https://github.com/serokell/xrefcheck/actions/workflows/ci.yml/badge.svg)
Xrefcheck is a tool for verifying local and external references in a repository's documentation that is quick, easy to setup, and suitable to be run on a CI pipeline.

View File

@ -12,7 +12,10 @@
pkgs = haskell-nix.legacyPackages.${system}.extend serokell-nix.overlay;
flake = (pkgs.haskell-nix.stackProject {
src = ./.;
src = builtins.path {
name = "xrefcheck";
path = ./.;
};
modules = [{
packages.xrefcheck = {
ghcOptions =
@ -84,6 +87,11 @@
checks = {
trailing-whitespace = pkgs.build.checkTrailingWhitespace ./.;
reuse-lint = pkgs.build.reuseLint ./.;
shellcheck = pkgs.build.shellcheck ./.;
hlint = pkgs.build.haskell.hlint ./.;
stylish-haskell = pkgs.build.haskell.stylish-haskell ./.;
test = self.packages.${system}."xrefcheck:test:xrefcheck-tests";
};
}
]