Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Artifact support #185

Merged
merged 4 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 127 additions & 26 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,133 @@
name: Build

on: [push]
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
toolchain-version: 1.53.0
llvm-version: "11.0.1"

jobs:
build:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.toolchain-version }}
profile: minimal
override: true

- name: Install LLVM
uses: ghaith/install-llvm-action@latest
with:
version: ${{ env.llvm-version }}

- name: Cargo check
uses: actions-rs/cargo@v1
with:
command: check

test:
name: Test
runs-on: ${{ matrix.config.os }}
needs: check
strategy:
fail-fast: false
matrix:
config:
- {
os: "ubuntu-latest",
dir: linux,
artifacts: "rustyc"
}
- {
os: "windows-latest",
dir: windows,
artifacts: "rustyc.exe rustyc.pdb"
}
steps:

- uses: actions/checkout@v2
with:
submodules: true

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.toolchain-version }}
profile: minimal
override: true

- name: Install LLVM
uses: ghaith/install-llvm-action@latest
with:
version: ${{ env.llvm-version }}
directory: "./llvm"

- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: -- --nocapture

- run: mkdir -p ${{ matrix.config.dir }}

- name: Move artifacts
env:
ARTIFACTS: ${{ matrix.config.artifacts }}
OUT_DIR: ${{ matrix.config.dir }}
run: |
import os
artifacts = os.environ['ARTIFACTS'].split()
for artifact in artifacts:
src = "target/debug/%s" % artifact
dst = os.environ['OUT_DIR'] + "/" + artifact
os.rename(src, dst)
shell: python

- uses: actions/upload-artifact@master
with:
name: ${{ matrix.config.dir }}-debug
path: ${{ matrix.config.dir }}

style:
name: Check Style
runs-on: ubuntu-latest
name: Cargo Docker build with LLVM-11
needs: check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cargo Build and Test
uses: ./docker-build/
with:
build-step: 'test'
- name: Formatter
uses: ./docker-build/
with:
build-step: 'fmt'
args: '-- --check'
- name: Clippy
uses: ./docker-build/
with:
build-step: 'clippy'
args: '-- -D warnings'

# - name: rust-tarpaulin
# uses: actions-rs/tarpaulin@v0.1
# - name: Codecov
# uses: codecov/codecov-action@v1.1.1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v2
with:
submodules: true

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.toolchain-version }}
profile: minimal
override: true
components: clippy, rustfmt

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -D warnings

8 changes: 6 additions & 2 deletions src/codegen/generators/pou_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> {
.map(DataType::get_name)
.map(|it| self.llvm_index.get_associated_type(it).unwrap());
let parameters = vec![instance_struct_type.ptr_type(AddressSpace::Generic).into()];
let variadic = global_index.find_type_information(implementation.get_type_name()).map(|it| it.is_variadic()).unwrap_or(false);
let variadic = global_index
.find_type_information(implementation.get_type_name())
.map(|it| it.is_variadic())
.unwrap_or(false);

let function_declaration = self.create_llvm_function_type(parameters, variadic, return_type)?;
let function_declaration =
self.create_llvm_function_type(parameters, variadic, return_type)?;

let curr_f = module.add_function(pou_name, function_declaration, None);
Ok(curr_f)
Expand Down