Here is my config file.my tests work fine without mysql and successfully stop execution in that case but when running testcases with mysql it just get stuck over here.
name: CI
on: [push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14.x, 15.x ]
steps:
- uses: actions/checkout#v2
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up MySQL 8.0
uses: mirromutth/mysql-action#master
with:
mysql version: 8.0
mysql database: root
mysql root password: root
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm test
- name: Cancel previous runs of this workflow
uses: styfle/cancel-workflow-action#0.6.0
with:
access_token: ${{ github.token }}
env:
CI: true
Related
I have a non-gradle root project which should launch child gh action, but can’t figure out how to. File child.yml should generate apk artifact, since android/ dir is app directory.
Project structure:
root
|
--- .github/workflows/root.yml
--- android/
|
___ .github/actions/apk/child.yml
Closest I get was running a yaml on root level:
root.yml
name: use my action
on:
push:
branches:
- ci_test
jobs:
#Build job
test_build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout#v2
- uses: ./android/.github/actions/apk
child.yml
name: Build of dev branch
on:
push:
branches:
- develop
jobs:
#Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout#v2
- uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: '11'
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build the app
run: ./gradlew assembleDebug
- name: Upload apk
uses: actions/upload-artifact#v2
with:
name: debug apk
path: ./app/build/outputs/apk/debug/app-debug.apk
But I get an error with doubled "/my-root-dir/my-root-dir"
Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/my-root-dir/my-root-dir/android/.github/actions/child.yaml'. Did you forget to run actions/checkout before running your local action?
On every commit, I'm building my project on different Operating Systems. Therefore I'm using CMake as a build system for my C++ code.
In order to make the builds faster I tried to cache older builds, so not changed files don't have to be rebuilt.
I've written the following GH Action Script:
name: Build for MacOS, Ubuntu and Windows
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macos-11, windows-2022 ]
steps:
- uses: actions/checkout#v2
- name: Cache build
uses: actions/cache#v3
with:
path: ${{github.workspace}}/build
key: ${{ matrix.os }}-build
restore-keys: ${{ matrix.os }}-build
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DFORCE_COLORED_OUTPUT=1
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Width ...
- name: Cache build
uses: actions/cache#v3
with:
path: ${{github.workspace}}/build
key: ${{ matrix.os }}-build
restore-keys: ${{ matrix.os }}-build
... I tried to cache the directory all the build files are written to, but it looks like the project is completely rebuilt every time.
Is there anything I'm doing wrong?
I uploaded all logs to https://pastebin.com/JLErAPyD
GitHub Action keeps telling me the following error: every step must define a uses or run key I think I set the uses or run for each step already. What's the problem?
name: cci-api cicd
on: [push,pull_request]
jobs:
ci-enviroment-setup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout#v2
- name: Setup Python
uses: actions/setup-python#v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Setup Poetry
- run: |
python -m pip install -U pip
pip install poetry
poetry install
- name: Azure Login
- uses: Azure/login#v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure key vault - Get DB Secrets
uses: Azure/get-keyvault-secrets#v1
with:
keyvault: kv-prt-us-dev
secrets: prt-cet
As other pointed out, each step is required to have either run or uses key:
name: cci-api cicd
on: [push,pull_request]
jobs:
ci-enviroment-setup:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout#v2
- name: Setup Python
uses: actions/setup-python#v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Setup Poetry
# removed - in front of run key
run: |
python -m pip install -U pip
pip install poetry
poetry install
- name: Azure Login
# removed - in front of uses key
uses: Azure/login#v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Azure key vault - Get DB Secrets
uses: Azure/get-keyvault-secrets#v1
with:
keyvault: kv-prt-us-dev
secrets: prt-cet
Currently, I got some problems when I try to write the YAML file for deploying the GitHub action for KMM project. I don't know how to write the correct script (gradlew command) about testing the code of the shared module. Here's a part of my YAML file:
test_job:
name: Test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v2
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action#e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Restore Cache
uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradle executable
run: chmod +x ./gradlew
- name: Run Debug Tests
run: ./gradlew testDebugUnitTest --continue
- name: Upload Test Reports
if: ${{ always() }}
uses: actions/upload-artifact#v2
with:
name: test-reports
path: '**/build/reports/tests/'
You can use:
./gradlew check to run tests for all your targets
./gradlew <targetName>Test to run it for a specific target
Note that probably you'd want to specify the shared module as well, for ex: ./gradlew :shared:check
For more information you could check out: https://kotlinlang.org/docs/mpp-run-tests.html#run-tests-for-one-or-more-targets
I am going through a course and I am getting a syntax error on the second last line below (shell: bash). Any ideas? If I remove that line I get the same error on the next line (run: npm ci).
name: Build, test, & deploy
on: [push]
jobs:
build:
name: Project build & package
if: "!contains(github.even.head_commit.message, '[skip-ci]'"
runs-on: ubuntu-latest
steps:
-name: checkout repo action
uses: actions/checkout#master
-name: Setup Node v10.x
uses: actions/setup-node#v1
with:
node-version:10.x
-name: Cache Node.js packages
uses: actions/cache#v1
env:
cache-name: cache-node-packages
with:
#use `~/npm` for macOS / Linux agents
# & '%AppData%/npm-cache' for Windows agents
path: ~./npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
-name: Resolve project dependencies with NPM
shell: bash
run: npm ci
The biggest problems were spacing and indentation. I also had a missing paren.
name: Build, test, & deploy
on: [push]
jobs:
build:
name: Project build & package
if: "!contains(github.even.head_commit.message, '[skip-ci]')"
runs-on: ubuntu-latest
steps:
- name: checkout repo action
uses: actions/checkout#master
- name: Setup Node v10.x
uses: actions/setup-node#v1
with:
node-version: 10.x
- name: Cache Node.js packages
uses: actions/cache#v1
env:
cache-name: cache-node-packages
with:
#use `~/npm` for macOS / Linux agents
# & '%AppData%/npm-cache' for Windows agents
path: ~./npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Resolve project dependencies with NPM
shell: bash
run: npm ci