Skip to content

CI

CI #73

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '17 7 * * 1-5' # run once per day Monday-Friday at 7:17am
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci-everything:
name: All CI stages
runs-on: ubuntu-latest
needs:
- lint
- tests
if: ${{ success() || failure() }} # Run this job even if a dependency has failed.
steps:
- name: Job outcomes
run: |
echo "lint: ${{ needs.lint.result }}"
echo "tests: ${{ needs.tests.result }}"
# Fail this required job if any of its dependent jobs have failed.
#
# Do not attempt to consolidate these steps into one step, it won't work.
# Multi-line `if` clauses are not evaluated properly: see the intermediate commits in
# https://github.com/obi1kenobi/cargo-semver-checks/pull/405
- if: ${{ needs.lint.result != 'success' }}
run: exit 1
- if: ${{ needs.tests.result != 'success' }}
run: exit 1
lint:
name: Check lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- run: npm ci
- run: npm run lint
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- run: npm ci
- run: npm run compile
- run: echo "skipping `npm test` because currently that requires an X server"
init-publish:
name: Run the publish workflow
needs:
- should-publish
- ci-everything
if: needs.should-publish.outputs.is_new_version == 'yes' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/publish.yml
permissions:
contents: write
secrets:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
VS_MARKETPLACE_TOKEN: ${{ secrets.VS_MARKETPLACE_TOKEN }}
should-publish:
name: Check if version changed
runs-on: ubuntu-latest
outputs:
is_new_version: ${{ steps.check.outputs.is_new_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- id: check
run: |
set +e
.github/workflows/is_extension_version_already_tagged.sh
export EXIT_CODE="$?"
set -e
if [[ "$EXIT_CODE" == "7" ]]; then
echo 'is_new_version=no' >> $GITHUB_OUTPUT
elif [[ "$EXIT_CODE" == "0" ]]; then
echo 'is_new_version=yes' >> $GITHUB_OUTPUT
else
# Unexpected outcome, indicates a bug.
exit "$EXIT_CODE"
fi