|
| 1 | +name: build |
| 2 | + |
| 3 | +# Controls when the action will run. |
| 4 | +on: |
| 5 | + # Triggers the workflow on push event only for all branches |
| 6 | + push: |
| 7 | + branches: [ main, master, develop ] |
| 8 | + #pull_request: |
| 9 | + # branches: [ main, master ] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + # This workflow contains a single job called "build" |
| 16 | + setup-sdk: |
| 17 | + runs-on: ubuntu-18.04 |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Cache sdk |
| 21 | + id: cache-sdk |
| 22 | + uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: | |
| 25 | + cc65/**/* |
| 26 | + orix-sdk/**/* |
| 27 | + md2hlp/**/* |
| 28 | + orix-software/**/* |
| 29 | + key: ${{ runner.os }}-orix-sdk_ |
| 30 | + |
| 31 | + - name: Checkout cc65 |
| 32 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 33 | + uses: actions/checkout@v2 |
| 34 | + with: |
| 35 | + repository: cc65/cc65 |
| 36 | + path: cc65 |
| 37 | + |
| 38 | + - name: Checkout orix-sdk |
| 39 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 40 | + uses: actions/checkout@v2 |
| 41 | + with: |
| 42 | + repository: assinie/orix-sdk |
| 43 | + path: orix-sdk |
| 44 | + |
| 45 | + - name: Checkout md2hlp |
| 46 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 47 | + uses: actions/checkout@v2 |
| 48 | + with: |
| 49 | + repository: assinie/md2hlp |
| 50 | + path: md2hlp |
| 51 | + |
| 52 | + - name: Compilation CC65 |
| 53 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 54 | + run: make -C cc65 >/dev/null |
| 55 | + |
| 56 | + - name: Prepare environment for orix-sdk |
| 57 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 58 | + run: | |
| 59 | + git clone --no-checkout --depth 1 --single-branch --branch master https://github.com/orix-software/shell orix-software/shell |
| 60 | + cd orix-software/shell |
| 61 | + git config --local core.sparseCheckout true |
| 62 | + echo "src/include" >> .git/info/sparse-checkout |
| 63 | + git checkout |
| 64 | + cd ../.. |
| 65 | + git clone --no-checkout --depth 1 --single-branch --branch master https://github.com/orix-software/kernel orix-software/kernel |
| 66 | + cd orix-software/kernel |
| 67 | + git config --local core.sparseCheckout true |
| 68 | + echo "src/include" >> .git/info/sparse-checkout |
| 69 | + git checkout |
| 70 | +
|
| 71 | + - name: Compile orix-sdk |
| 72 | + if: steps.cache-sdk.outputs.cache-hit != 'true' |
| 73 | + working-directory: orix-sdk |
| 74 | + run: mkdir -p build/{lib,bin} && CC65_HOME=${GITHUB_WORKSPACE}/cc65 make lib |
| 75 | + |
| 76 | + - name: Display tools |
| 77 | + run: | |
| 78 | + PATH=$PATH:${GITHUB_WORKSPACE}/cc65/bin |
| 79 | + cc65 -V |
| 80 | + ls -lR orix-sdk |
| 81 | + ls -l cc65/bin |
| 82 | +
|
| 83 | + build: |
| 84 | + # The type of runner that the job will run on |
| 85 | + needs: setup-sdk |
| 86 | + runs-on: ubuntu-18.04 |
| 87 | + outputs: |
| 88 | + version: ${{ steps.job_vars.outputs.VERSION }} |
| 89 | + repo_name: ${{ steps.job_vars.outputs.REPO_NAME }} |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v2 |
| 93 | + |
| 94 | + - name: Set job variables |
| 95 | + id: job_vars |
| 96 | + run: | |
| 97 | + echo "::set-output name=VERSION::$(cat VERSION)" |
| 98 | + echo "::set-output name=REPO_NAME::${GITHUB_REPOSITORY##*/}" |
| 99 | +
|
| 100 | + - name: Install sdk |
| 101 | + uses: actions/cache@v2 |
| 102 | + with: |
| 103 | + path: | |
| 104 | + cc65/**/* |
| 105 | + orix-sdk/**/* |
| 106 | + md2hlp/**/* |
| 107 | + orix-software/**/* |
| 108 | + key: ${{ runner.os }}-orix-sdk_ |
| 109 | + |
| 110 | + - name: Prepare environment for project |
| 111 | + run: mv cc65 ../ && mv orix-software ../ && mv orix-sdk ../ && mv md2hlp ../ |
| 112 | + |
| 113 | + - name: Compile project |
| 114 | + run: CC65_HOME=${GITHUB_WORKSPACE}/../cc65 make |
| 115 | + |
| 116 | + - name: List build directory content |
| 117 | + run: ls -lR build |
| 118 | + |
| 119 | + - name: Upload Artifact |
| 120 | + uses: actions/upload-artifact@v2 |
| 121 | + with: |
| 122 | + name: ${{ steps.job_vars.outputs.REPO_NAME }} |
| 123 | + path: | |
| 124 | + build/**/* |
| 125 | + !build/obj/* |
| 126 | +
|
| 127 | + - name: Post compilation |
| 128 | + run: mv ../cc65 . && mv ../orix-software . && mv ../orix-sdk . && mv ../md2hlp . |
| 129 | + |
| 130 | + upload: |
| 131 | + needs: build |
| 132 | + runs-on: ubuntu-18.04 |
| 133 | + defaults: |
| 134 | + run: |
| 135 | + shell: bash |
| 136 | + env: |
| 137 | + hash: ${{ secrets.HASH }} |
| 138 | + version: ${{ needs.build.outputs.version }} |
| 139 | + repo_name: ${{ needs.build.outputs.repo_name }} |
| 140 | + |
| 141 | + steps: |
| 142 | + - name: Get branch name |
| 143 | + if: github.event_name != 'pull_request' |
| 144 | + run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV |
| 145 | + # run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF##*/})" |
| 146 | + |
| 147 | + - name: Get branch name on pull request |
| 148 | + if: github.event_name == 'pull_request' |
| 149 | + run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> GITHUB_ENV |
| 150 | + #run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF})" |
| 151 | + |
| 152 | + - name: Get archive name |
| 153 | + run: echo "ARCHIVE_NAME=${repo_name}.tgz" >> $GITHUB_ENV |
| 154 | + |
| 155 | + # On pourrait faire l'extraction directement à la racine si VERSION est dans l'artifact |
| 156 | + - name: Download Artifact |
| 157 | + id: download |
| 158 | + uses: actions/download-artifact@v2 |
| 159 | + with: |
| 160 | + name: ${{ needs.build.outputs.repo_name }} |
| 161 | + path: artifact |
| 162 | + |
| 163 | + - name: Make archive |
| 164 | + working-directory: ${{steps.download.outputs.download-path}} |
| 165 | + run: tar -zcvf $GITHUB_WORKSPACE/$ARCHIVE_NAME * |
| 166 | + |
| 167 | + - name: Upload to oric |
| 168 | + run: | |
| 169 | + if [ "$BRANCH_NAME" = "master" -o "$BRANCH_NAME" = "main" ]; then VERSION="$version"; else VERSION=alpha ; fi |
| 170 | + curl -X POST --data-binary "@${ARCHIVE_NAME}" "https://cdn.oric.org/publish.php?hash=$hash&path=/home/oricoujr/www/ftp/orix/dists/$VERSION/tgz/6502/${ARCHIVE_NAME}" |
| 171 | +
|
0 commit comments