odin/Test #10
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
# This workflow will do a clean install of the dependencies and run tests across different versions. | |
# It will also apply automatic code formatting. | |
# | |
# Find Github Actions to setup tooling here: | |
# - https://github.com/actions/?q=setup&type=&language= | |
# - https://github.com/actions/starter-workflows/tree/main/ci | |
# - https://github.com/marketplace?type=actions&query=setup | |
# | |
# Requires scripts: | |
# - bin/test | |
name: odin / Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
ci: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
- name: Setup Odin | |
uses: laytan/setup-odin@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# TODO: Pull a specific version of Odin compatible with the OS. | |
# The current setting pulls the latest version of Odin from the repo, and rebuilds it from | |
# scratch. This is slow, and clutters the action's log. Rather ensure that the OS has the | |
# right dependencies for a recent versioned release of the compiler. | |
release: false | |
llvm-version: 14 | |
- name: Install project dependencies | |
run: bin/fetch-configlet | |
- name: Run the project linter | |
run: bin/configlet lint | |
- name: Verify all exercises | |
run: bin/run-test.sh | |
- name: Apply code formatting to all .odin files | |
run: bin/format-all.sh | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'G-J van Rooyen' | |
git config --global user.email 'gvrooyen@gmail.com' | |
git diff --quiet && git diff --staged --quiet || git commit -am "Automated formatting" && git push |