Merge pull request #4 from Dracks/fix/prod-build #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
name: New changes validation | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
env: | |
WORK_PATH: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/ | |
jobs: | |
cache-V: | |
runs-on: ubuntu-latest | |
steps: | |
# Because of problems with `setup-v` action, when Vlang version is specified, and also because of V evolving continuously, | |
# and you need the latest commit of V most of the time, we always use the latest V version from the master branch | |
# and getting it from the cache on the start of a job is not possible (because you need to know a version of V to cache it). | |
# This step should be uncommented when Vlang will be stable and caching will be possible. | |
# - name: Check if V is cached | |
# id: check-v-cache | |
# uses: actions/cache/restore@v3 | |
# with: | |
# path: ${{ env.WORK_PATH }}vlang/ | |
# key: vlang-0.3.3-weekly.2023.08 | |
- name: Install V | |
id: install-v | |
uses: vlang/setup-v@v1.3 | |
with: | |
check-latest: true | |
- name: Set V_VERSION environment variable | |
run: echo "V_VERSION=$(v -v)" >> $GITHUB_ENV | |
- name: Cache Vlang | |
uses: actions/cache/save@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: vlang-${{ env.V_VERSION }} | |
simple-build: | |
needs: cache-V | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
trimming: [ null , -skip-unused ] | |
memory-management: [ null , -autofree ] | |
steps: | |
- name: Restore Vlang | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: vlang-${{ env.V_VERSION }} | |
fail-on-cache-miss: true | |
- name: Install V | |
uses: vlang/setup-v@v1.3 | |
with: | |
check-latest: true | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: v install | |
- name: ${{ matrix.trimming }} ${{ matrix.memory-management }} build | |
run: v -shared -prod ${{ matrix.trimming }} ${{ matrix.memory-management }} . | |
tests: | |
needs: simple-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore Vlang | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: vlang-${{ env.V_VERSION }} | |
fail-on-cache-miss: true | |
- name: Install V | |
uses: vlang/setup-v@v1.3 | |
with: | |
check-latest: true | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: v install | |
- name: Run tests | |
run: v test . | |
check-format: | |
needs: simple-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore Vlang | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.WORK_PATH }}vlang/ | |
key: vlang-${{ env.V_VERSION }} | |
fail-on-cache-miss: true | |
- name: Install V | |
uses: vlang/setup-v@v1.3 | |
with: | |
check-latest: true | |
- name: Checkout ${{ github.event.repository.name }} | |
uses: actions/checkout@v3 | |
- name: Run tests | |
run: v fmt -c . |