ci #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * SUN" | |
jobs: | |
ci-config: | |
runs-on: ubuntu-latest | |
outputs: | |
enabled: ${{ steps.set-enabled.outputs.enabled }} | |
roswell-version: ${{ steps.set-deps-versions.outputs.roswell-version }} | |
asdf-version: ${{ steps.set-deps-versions.outputs.asdf-version }} | |
qlot-version: ${{ steps.set-deps-versions.outputs.qlot-version }} | |
steps: | |
- id: set-enabled | |
name: Set enabled | |
run: | | |
event_name=${{ github.event_name }} | |
pull_request_repo=${{ github.event.pull_request.head.repo.full_name }} | |
repo=${{ github.repository }} | |
enabled=no | |
# We want to run on external PRs, but not on our own internal PRs as | |
# they'll be run by the push to the branch. | |
if test "$event_name" != 'pull_request' -o "$pull_request_repo" != "$repo" | |
then | |
enabled=yes | |
fi | |
echo "::set-output name=enabled::$enabled" | |
- id: set-deps-versions | |
name: Set dependencies versions | |
run: | | |
event_name=${{ github.event_name }} | |
roswell_version=v21.10.14.111 | |
asdf_version=3.3.5.3 | |
qlot_version=0.11.5 | |
if [[ $event_name == 'schedule' ]]; then | |
roswell_version=latest | |
asdf_version=latest | |
qlot_version=latest | |
fi | |
echo "::set-output name=roswell-version::$roswell_version" | |
echo "::set-output name=asdf-version::$asdf_version" | |
echo "::set-output name=qlot-version::$qlot_version" | |
build: | |
needs: ci-config | |
if: needs.ci-config.outputs.enabled == 'yes' | |
strategy: | |
fail-fast: false # Let the workflow continue as much as possible | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
lisp: [ sbcl-bin/2.4.1 ] | |
include: | |
- os: windows-latest | |
destination: cg.exe | |
- os: ubuntu-latest | |
destination: cg-linux | |
- os: macos-latest | |
destination: cg-osx | |
defaults: | |
run: | |
shell: lispsh {0} | |
name: build with ${{ matrix.lisp }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: 40ants/setup-lisp@v2 | |
with: | |
roswell-version: ${{ needs.ci-config.outputs.roswell-version }} | |
asdf-version: ${{ needs.ci-config.outputs.asdf-version }} | |
qlot-version: ${{ needs.ci-config.outputs.qlot-version }} | |
- uses: actions/checkout@v2 | |
with: | |
# By default, this action would fetch a single commit only; | |
# however, we are counting the number of commits since the "last tag" | |
# inside build.lisp, and in order for that to work we have to figure | |
# out a way to fetch all the ancestors of the current commit until we | |
# land on the target tag...or we fetch all the history. | |
# | |
# Fetching the complete history will do just fine. | |
fetch-depth: 0 | |
- run: make lisp-info-ros | |
- run: make binary-ros | |
- run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
# On Windows, `mv` might fail with the following error message: | |
# | |
# mv: 'bin/cg' and 'bin/cg.exe' are the same file | |
# | |
# So here we just check that the binary is where it should be | |
# would fail if the mv operation had failed | |
test -f bin/${{ matrix.destination }} | |
else | |
mv bin/cg bin/${{ matrix.destination }} | |
fi | |
- name: Test loading of custom .cgrc | |
run: | | |
bin/${{ matrix.destination }} --version | |
cat <<EOF > ~/.cgrc | |
(cg:define-guesser echo | |
("(.+)" (cmd)) | |
(format NIL "~a" cmd)) | |
EOF | |
bin/${{ matrix.destination }} --debug | grep ECHO | |
- name: Upload the binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: binaries | |
path: bin/${{ matrix.destination }} | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: binaries | |
path: bin/ | |
- name: Extract release notes | |
id: extract-release-notes | |
uses: ffurrer2/extract-release-notes@v1 | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
prerelease: false | |
body: ${{ steps.extract-release-notes.outputs.release_notes }} | |
files: bin/* |